开发者

Enabling cache_classes causes undefined method `increment_counter' for ActiveRecord::Relation:Class

开发者 https://www.devze.com 2023-04-02 09:12 出处:网络
After upgrade to Rails 3.0.10 I\'m getting strange error if I set config.cache_classes=true NoMethodError (undefined method increment_counter\' for ActiveRecord::Relation:Class):

After upgrade to Rails 3.0.10 I'm getting strange error if I set config.cache_classes=true

NoMethodError (undefined method increment_counter' for ActiveRecord::Relation:Class): activerecord (3.0.10) lib/active_record/associations.rb:1553:inbel开发者_StackOverflowongs_to_counter_cache_after_create_for_form' activesupport (3.0.10) lib/active_support/callbacks.rb:424:in _run_create_callbacks' activerecord (3.0.10) lib/active_record/callbacks.rb:277:increate' activerecord (3.0.10) lib/active_record/persistence.rb:257:in create_or_update' activerecord (3.0.10) lib/active_record/callbacks.rb:273:increate_or_update' activesupport (3.0.10) lib/active_support/callbacks.rb:444:in _run_save_callbacks' activerecord (3.0.10) lib/active_record/callbacks.rb:273:increate_or_update' activerecord (3.0.10) lib/active_record/persistence.rb:60:in save!' activerecord (3.0.10) lib/active_record/validations.rb:49:insave!' activerecord (3.0.10) lib/active_record/attribute_methods/dirty.rb:30:in `save!' ...

I'm saving Answer model which has belongs_to relation with counter cache:

belongs_to    :form, :counter_cache => true

Strangest thing is that after server restart first save works fine and after that I start getting such exceptions.

Maybe someone could advise where I could start digging for a cause?


The problem was caused by outdated acts_as_taggable_on_steroids gem which was causing class cache issues with Rails3. Switched to acts-as-taggable-on gem - problem solved.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号