Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2013 06:08
Show Gist options
  • Save anonymous/5856301 to your computer and use it in GitHub Desktop.
Save anonymous/5856301 to your computer and use it in GitHub Desktop.
class UpdatePetsCache < ActiveRecord::Migration
def up
User.all.each do |user|
User.reset_counters user.id, :pets
end
end
def down
end
end
[out :: ] == UpdatePetsCache: migrating ================================================
[out :: ]
[out :: ] rake aborted!
[out :: ]
[out :: ] An error has occurred, this and all later migrations canceled:
[out :: ]
[out :: ]
[out :: ] uninitialized constant User::Pet
[out :: ] /var/www/Test/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/inheritance.rb:111:in `compute_type'
[out :: ]
[out :: ] /var/www/Test/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/reflection.rb:172:in `klass'
[out :: ]
[out :: ] /var/www/Test/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/counter_cache.rb:33:in `block in res
ounters'
[out :: ]
[out :: ] /var/www/Test/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/counter_cache.rb:19:in `each'
[out :: ]
[out :: ] /var/www/Test/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/counter_cache.rb:19:in `reset_counte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment