diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-23 23:39:18 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-23 23:39:18 +0000 |
commit | a5c694283010c05ee39bc0757e8013b3aa382992 (patch) | |
tree | 699e52cd748c9675c790535f7a77c8144565d514 /activerecord/lib | |
parent | 5f5f19b06d8a4db4a61055280660dc57180ff47c (diff) | |
download | rails-a5c694283010c05ee39bc0757e8013b3aa382992.tar.gz rails-a5c694283010c05ee39bc0757e8013b3aa382992.tar.bz2 rails-a5c694283010c05ee39bc0757e8013b3aa382992.zip |
Fixed that :counter_cache option would look for a line_items_count column for a LineItem object instead of lineitems_count
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 229cfb5cfa..f9f5ec98a6 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -376,12 +376,12 @@ module ActiveRecord if options[:counter_cache] module_eval( - "after_create '#{association_class_name}.increment_counter(\"#{Inflector.pluralize(self.to_s.downcase). + "_count"}\", #{association_class_primary_key_name})" + + "after_create '#{association_class_name}.increment_counter(\"#{self.to_s.underscore.pluralize + "_count"}\", #{association_class_primary_key_name})" + " unless #{association_name}.nil?'" ) module_eval( - "before_destroy '#{association_class_name}.decrement_counter(\"#{Inflector.pluralize(self.to_s.downcase) + "_count"}\", #{association_class_primary_key_name})" + + "before_destroy '#{association_class_name}.decrement_counter(\"#{self.to_s.underscore.pluralize + "_count"}\", #{association_class_primary_key_name})" + " unless #{association_name}.nil?'" ) end |