Created
March 18, 2011 16:53
-
-
Save spastorino/876407 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb | |
| index 6a593a7..832f2ed 100644 | |
| --- a/activerecord/lib/active_record/attribute_methods/write.rb | |
| +++ b/activerecord/lib/active_record/attribute_methods/write.rb | |
| @@ -10,7 +10,9 @@ module ActiveRecord | |
| module ClassMethods | |
| protected | |
| def define_method_attribute=(attr_name) | |
| - generated_attribute_methods.module_eval("def #{attr_name}=(new_value); write_attribute('#{attr_name}', new_value); end", __FILE__, __LINE__) | |
| + generated_attribute_methods.send(:define_method, "#{attr_name}=") do |new_value| | |
| + write_attribute(attr_name, new_value) | |
| + end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment