diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-10 23:01:18 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-10 23:01:18 +0000 |
commit | cff25aae90859d5f47d827b162b505f8b316b733 (patch) | |
tree | 58220be1e52998913f4e1ca9131f9bb3898a9818 /activerecord | |
parent | 0ad5365bf4f71adb32ea543f74615e86edce7b28 (diff) | |
download | rails-cff25aae90859d5f47d827b162b505f8b316b733.tar.gz rails-cff25aae90859d5f47d827b162b505f8b316b733.tar.bz2 rails-cff25aae90859d5f47d827b162b505f8b316b733.zip |
eval with __FILE__ and __LINE__
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7827 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-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 |