rake aborted!PG::Error: ERROR: relation "users" does not existliNE 4: WHERE a.attrelID = '"users"'::regclass ^: SELECT a.attname,format_type(a.atttypID,a.atttypmod),d.adsrc,a.attnotnull FROM pg_attribute a left JOIN pg_attrdef d ON a.attrelID = d.adrelID AND a.attnum = d.adnum WHERE a.attrelID = '"users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
任何想法为什么以及如何解决它?
如果我用trace运行它,我可以看到从staffer.rb:103生成错误,其中包含:
scope :visible,where(:deleted => false)
似乎整个事情都是由active_admin触发的,admin / users.rb的第一行看起来像:
# enCoding: UTF-8# Activeadmin.register User do menu :priority => 2 filter :ID filter :rID filter :tenant filter :type,:as => :check_Boxes,:collection => %w{Manager Staffer} filter :state,:collection => Staffer::STATES filter :email filter :first_name filter :last_name
整个错误看起来像这样:
1.9.3-p194@projectx root@b1:/var/Nginx/projectx/releases/20120710151049# bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile --trace** Invoke assets:precompile (first_time)** Execute assets:precompile** Invoke assets:precompile:all (first_time)** Execute assets:precompile:all** Invoke assets:precompile:primary (first_time)** Invoke assets:environment (first_time)** Execute assets:environment** Invoke environment (first_time)** Execute environmentResolved collector.newrelic.com to 204.93.223.153rake aborted!PG::Error: ERROR: relation "users" does not existliNE 4: WHERE a.attrelID = '"users"'::regclass ^: SELECT a.attname,a.attnotnull FROM pg_attribute a left JOIN pg_attrdef d ON a.attrelID = d.adrelID AND a.attnum = d.adnum WHERE a.attrelID = '"users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in `async_exec'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in `exec_no_cache'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:664:in `block in exec_query'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `exec_query'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1276:in `column_deFinitions'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:859:in `columns'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in `yIEld'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in `default'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in `columns'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:237:in `columns_hash'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/inheritance.rb:19:in `descends_from_active_record?'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/base.rb:455:in `relation'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/scoping/named.rb:37:in `scoped'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/querying.rb:9:in `where'/var/Nginx/projectx/releases/20120710151049/app/models/staffer.rb:103:in `<class:Staffer>'/var/Nginx/projectx/releases/20120710151049/app/models/staffer.rb:6:in `<top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:251:in `require'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:251:in `block in require'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:236:in `load_dependency'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:251:in `require'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:359:in `require_or_load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:502:in `load_missing_constant'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:192:in `block in const_missing'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:190:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:190:in `const_missing'/var/Nginx/projectx/releases/20120710151049/app/admin/users.rb:11:in `block in <top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/dsl.rb:13:in `instance_eval'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/dsl.rb:13:in `run_registration_block'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/namespace.rb:178:in `parse_registration_block'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/namespace.rb:54:in `register'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/application.rb:99:in `register'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin.rb:74:in `register'/var/Nginx/projectx/releases/20120710151049/app/admin/users.rb:4:in `<top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:245:in `load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:245:in `block in load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:236:in `load_dependency'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:245:in `load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/application.rb:161:in `block in load!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/application.rb:161:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/application.rb:161:in `load!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/application.rb:187:in `routes'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin.rb:78:in `routes'/var/Nginx/projectx/releases/20120710151049/config/routes.rb:114:in `block (2 levels) in <top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:749:in `block in constraints'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:624:in `scope'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:749:in `constraints'/var/Nginx/projectx/releases/20120710151049/config/routes.rb:113:in `block in <top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:260:in `draw'/var/Nginx/projectx/releases/20120710151049/config/routes.rb:3:in `<top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:245:in `load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:245:in `block in load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:236:in `load_dependency'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:245:in `load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application/routes_reloader.rb:40:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application/routes_reloader.rb:40:in `load_paths'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application/routes_reloader.rb:16:in `reload!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application.rb:108:in `reload_routes!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:34:in `reload!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:61:in `block in attach!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:429:in `_run__4352394538915700711__prepare__777820976777011506__callbacks'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/mIDdleware/reloader.rb:74:in `prepare!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/mIDdleware/reloader.rb:48:in `prepare!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/initializable.rb:30:in `run'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/initializable.rb:54:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application.rb:136:in `initialize!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/railtIE/configurable.rb:30:in `method_missing'/var/Nginx/projectx/releases/20120710151049/config/environment.rb:5:in `<top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:251:in `require'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:251:in `block in require'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:236:in `load_dependency'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencIEs.rb:251:in `require'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application.rb:103:in `require_environment!'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/railtIEs-3.2.6/lib/rails/application.rb:292:in `block (2 levels) in initialize_tasks'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'/usr/local/rvm/rubIEs/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'/usr/local/rvm/rubIEs/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'/usr/local/rvm/rubIEs/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'/usr/local/rvm/rubIEs/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'/usr/local/rvm/rubIEs/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/bin/rake:23:in `load'/var/Nginx/projectx/shared/bundle/ruby/1.9.1/bin/rake:23:in `<main>'Tasks: top => environment解决方法 将scope与where子句一起使用将导致ActiveRecord尝试加载表的列和其他信息,以便它可以预构建ActiveRelation.一个简单的解决方案是将proc中的where部分包裹起来,或者(我最喜欢的)不使用范围并使用类方法.这会做同样的事情,并且随着您的范围变得越来越复杂,您将看到它比使用范围更清晰.
def self.visible where(:deleted => false)end总结
以上是内存溢出为你收集整理的ruby-on-rails – 运行rake资产:当没有表时,预编译失败(尚)全部内容,希望文章能够帮你解决ruby-on-rails – 运行rake资产:当没有表时,预编译失败(尚)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)