diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/aggregations.rb | 10 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 5be629e3d5..8c3cdc3c11 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -153,7 +153,7 @@ module ActiveRecord "true" end - module_eval <<-end_eval + module_eval <<-end_eval, __FILE__, __LINE__ def #{name}(force_reload = false) if (@#{name}.nil? || force_reload) && #{allow_nil_condition} @#{name} = #{class_name}.new(#{mapping.collect { |pair| "read_attribute(\"#{pair.first}\")"}.join(", ")}) @@ -161,13 +161,13 @@ module ActiveRecord return @#{name} end end_eval - end - + end + def writer_method(name, class_name, mapping, allow_nil) mapping = (Array === mapping.first ? mapping : [ mapping ]) if allow_nil - module_eval <<-end_eval + module_eval <<-end_eval, __FILE__, __LINE__ def #{name}=(part) if part.nil? #{mapping.collect { |pair| "@attributes[\"#{pair.first}\"] = nil" }.join("\n")} @@ -178,7 +178,7 @@ module ActiveRecord end end_eval else - module_eval <<-end_eval + module_eval <<-end_eval, __FILE__, __LINE__ def #{name}=(part) @#{name} = part.freeze #{mapping.collect{ |pair| "@attributes[\"#{pair.first}\"] = part.#{pair.last}" }.join("\n")} diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index dc0bd2d125..118b596591 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -157,7 +157,7 @@ module ActiveRecord end begin - class_eval(method_definition) + class_eval(method_definition, __FILE__, __LINE__) rescue SyntaxError => err generated_methods.delete(attr_name) if logger |