Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 989

Show
Ignore:
Timestamp:
03/23/05 23:39:18 (4 years ago)
Author:
david
Message:

Fixed that :counter_cache option would look for a line_items_count column for a LineItem object instead of lineitems_count

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r983 r989  
    11*SVN* 
     2 
     3* Fixed that :counter_cache option would look for a line_items_count column for a LineItem object instead of lineitems_count 
    24 
    35* Fixed that AR exists?() would explode on postgresql if the passed id did not match the PK type #900 [Scott Barron] 
  • trunk/activerecord/lib/active_record/associations.rb

    r843 r989  
    377377        if options[:counter_cache] 
    378378          module_eval( 
    379             "after_create '#{association_class_name}.increment_counter(\"#{Inflector.pluralize(self.to_s.downcase). + "_count"}\", #{association_class_primary_key_name})" + 
     379            "after_create '#{association_class_name}.increment_counter(\"#{self.to_s.underscore.pluralize + "_count"}\", #{association_class_primary_key_name})" + 
    380380            " unless #{association_name}.nil?'" 
    381381          ) 
    382382 
    383383          module_eval( 
    384             "before_destroy '#{association_class_name}.decrement_counter(\"#{Inflector.pluralize(self.to_s.downcase) + "_count"}\", #{association_class_primary_key_name})" + 
     384            "before_destroy '#{association_class_name}.decrement_counter(\"#{self.to_s.underscore.pluralize + "_count"}\", #{association_class_primary_key_name})" + 
    385385            " unless #{association_name}.nil?'" 
    386386          )