aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-03-28 16:09:01 +0100
committerJon Leighton <j@jonathanleighton.com>2012-03-28 16:09:01 +0100
commit1b9fd797b3a3183044a3d7b9965b535ee7e27bc6 (patch)
treef6fea92512fec6865e4ac7ad494e79bf425e7871 /activerecord/lib/active_record/attribute_methods
parent4c44ca5cb9544b4186a0c9d54a7bfc9d30896f62 (diff)
downloadrails-1b9fd797b3a3183044a3d7b9965b535ee7e27bc6.tar.gz
rails-1b9fd797b3a3183044a3d7b9965b535ee7e27bc6.tar.bz2
rails-1b9fd797b3a3183044a3d7b9965b535ee7e27bc6.zip
Fix #5549.
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/read.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb
index 1548114580..9b3724777a 100644
--- a/activerecord/lib/active_record/attribute_methods/read.rb
+++ b/activerecord/lib/active_record/attribute_methods/read.rb
@@ -71,22 +71,25 @@ module ActiveRecord
generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
def __temp__
- #{internal_attribute_access_code(attr_name, cast_code)}
+ #{internal_attribute_access_code(attr_name, attribute_cast_code(attr_name))}
end
alias_method '#{attr_name}', :__temp__
undef_method :__temp__
STR
+ end
+
+ private
+ def define_external_attribute_method(attr_name)
generated_external_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
def __temp__(v, attributes, attributes_cache, attr_name)
- #{external_attribute_access_code(attr_name, cast_code)}
+ #{external_attribute_access_code(attr_name, attribute_cast_code(attr_name))}
end
alias_method '#{attr_name}', :__temp__
undef_method :__temp__
STR
end
- private
def cacheable_column?(column)
attribute_types_cached_by_default.include?(column.type)
end