diff options
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/read.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/write.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 506f5d75f9..d83c5a84b4 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -49,6 +49,8 @@ module ActiveRecord # key the @attributes_cache in read_attribute. def define_method_attribute(name) safe_name = name.unpack('h*').first + generated_attribute_methods::AttrNames.set_name_cache safe_name, name + generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 def __temp__#{safe_name} read_attribute(AttrNames::ATTR_#{safe_name}) { |n| missing_attribute(n, caller) } diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index cd33494cc3..541856c678 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -14,6 +14,8 @@ module ActiveRecord # this code. def define_method_attribute=(name) safe_name = name.unpack('h*').first + generated_attribute_methods::AttrNames.set_name_cache safe_name, name + generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 def __temp__#{safe_name}=(value) write_attribute(AttrNames::ATTR_#{safe_name}, value) |