-2

user.recipes.count会引发异常“没有给定接收器”。食谱关联上的每个操作都会执行它(第一个,最后一个,总和,...)。

没有宝石更新发生。

调用堆栈在这里:

activerecord (4.0.3) lib/active_record/relation/spawn_methods.rb:41:in `instance_exec'
activerecord (4.0.3) lib/active_record/relation/spawn_methods.rb:41:in `merge!'
activerecord (4.0.3) lib/active_record/relation/spawn_methods.rb:33:in `merge'
activerecord (4.0.3) lib/active_record/scoping/default.rb:115:in `block (2 levels) in build_default_scope'
activerecord (4.0.3) lib/active_record/scoping/default.rb:111:in `each'
activerecord (4.0.3) lib/active_record/scoping/default.rb:111:in `inject'
activerecord (4.0.3) lib/active_record/scoping/default.rb:111:in `block in build_default_scope'
activerecord (4.0.3) lib/active_record/scoping/default.rb:138:in `evaluate_default_scope'
activerecord (4.0.3) lib/active_record/scoping/default.rb:110:in `build_default_scope'
activerecord (4.0.3) lib/active_record/relation.rb:554:in `with_default_scope'
activerecord (4.0.3) lib/active_record/relation/finder_methods.rb:324:in `find_first'
activerecord (4.0.3) lib/active_record/relation/finder_methods.rb:90:in `first'
activerecord-deprecated_finders (1.0.3) lib/active_record/deprecated_finders/relation.rb:129:in `first'
activerecord (4.0.3) lib/active_record/associations/collection_association.rb:602:in `first_or_last'
activerecord (4.0.3) lib/active_record/associations/collection_association.rb:103:in `first'
activerecord (4.0.3) lib/active_record/associations/collection_proxy.rb:171:in `first'
app/views/users/_index.html.erb:26:in `block in _app_views_users__index_html_erb__4515165452254072945_70190748446560'
activerecord (4.0.3) lib/active_record/relation/delegation.rb:13:in `each'
activerecord (4.0.3) lib/active_record/relation/delegation.rb:13:in `each'
app/views/users/_index.html.erb:20:in `_app_views_users__index_html_erb__4515165452254072945_70190748446560'
(standard part following omitted)
4

1 回答 1

-1

看日志。有一个弃用警告:

DEPRECATION WARNING: Calling #default_scope without a block is deprecated. 
For example instead of `default_scope where(color: 'red')`, please use `default_scope { where(color: 'red') }`. 
(Alternatively you can just redefine self.default_scope.). (called from ...)

修复它修复了异常。

于 2014-08-28T07:05:48.497 回答