charlotte-ruby/impressionist — Issue #18: Counter Cache throws: You have a nil object when you didn't expect it!
Author: sickboy
Created: 2011-12-20 08:51:06+00:00
State: open

In model:
is_impressionable :counter_cache => { :column_name => :view_counter_cache }

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]

Backtrace:
impressionist (1.0.1) app/models/impressionist/impressionable.rb:47:in `update_counter_cache'
activesupport (3.1.3) lib/active_support/core_ext/object/try.rb:32:in `try'
impressionist (1.0.1) app/models/impression.rb:13:in `update_impressions_counter_cache'
activesupport (3.1.3) lib/active_support/callbacks.rb:401:in `_run_save_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.1.3) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.1.3) lib/active_record/persistence.rb:37:in `save'
activerecord (3.1.3) lib/active_record/validations.rb:50:in `save'
activerecord (3.1.3) lib/active_record/attribute_methods/dirty.rb:22:in `save'