From 3ca5a0f9fd7b7921bca970859da8637011b22dd1 Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Wed, 31 Dec 2008 01:43:13 -0800 Subject: Ensure belongs_to association with a counter cache in name spaced model works [#1678 state:resolved] Signed-off-by: Pratik Naik --- activerecord/lib/active_record/associations.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 80b3e23026..65a1319c7e 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1003,9 +1003,7 @@ module ActiveRecord # Create the callbacks to update counter cache if options[:counter_cache] - cache_column = options[:counter_cache] == true ? - "#{self.to_s.demodulize.underscore.pluralize}_count" : - options[:counter_cache] + cache_column = reflection.counter_cache_column method_name = "belongs_to_counter_cache_after_create_for_#{reflection.name}".to_sym define_method(method_name) do -- cgit v1.2.3