join the cult of cargo. reduce the number of NoMethodErrors in the system

This commit is contained in:
Aaron Patterson 2011-01-07 18:45:30 -08:00
parent 36d7bd1898
commit ec960c3730
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ module ActiveRecord
# Define read method for serialized attribute.
def define_read_method_for_serialized_attribute(attr_name)
access_code = "@attributes_cache['#{attr_name}'] ||= unserialize_attribute('#{attr_name}')"
generated_attribute_methods.module_eval("def #{attr_name}; #{access_code}; end", __FILE__, __LINE__)
generated_attribute_methods.module_eval("def _#{attr_name}; #{access_code}; end; alias #{attr_name} _#{attr_name}", __FILE__, __LINE__)
end
# Define an attribute reader method. Cope with nil column.