From f3d92f07565d1ec4b03fec7f3ba7c1c7d81e6073 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 7 Jan 2011 13:41:38 -0800 Subject: method is never called with arguments --- activerecord/lib/active_record/aggregations.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/aggregations.rb') diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 8cd7389005..0224187fed 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -223,14 +223,12 @@ module ActiveRecord private def reader_method(name, class_name, mapping, allow_nil, constructor) module_eval do - define_method(name) do |*args| - force_reload = args.first || false - + define_method(name) do unless instance_variable_defined?("@#{name}") instance_variable_set("@#{name}", nil) end - if (instance_variable_get("@#{name}").nil? || force_reload) && (!allow_nil || mapping.any? {|pair| !read_attribute(pair.first).nil? }) + if (instance_variable_get("@#{name}").nil?) && (!allow_nil || mapping.any? {|pair| !read_attribute(pair.first).nil? }) attrs = mapping.collect {|pair| read_attribute(pair.first)} object = case constructor when Symbol -- cgit v1.2.3