From c2b075bed084a59a674469d09db016aaa3365c2e Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Fri, 24 Jul 2009 00:25:27 -0500 Subject: Concernify AR AttributeMethods --- .../attribute_methods/before_type_cast.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 activerecord/lib/active_record/attribute_methods/before_type_cast.rb (limited to 'activerecord/lib/active_record/attribute_methods/before_type_cast.rb') diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb new file mode 100644 index 0000000000..65845c4d9a --- /dev/null +++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb @@ -0,0 +1,21 @@ +module ActiveRecord + module AttributeMethods + module BeforeTypeCast + extend ActiveSupport::Concern + + included do + attribute_method_suffix "_before_type_cast" + end + + def read_attribute_before_type_cast(attr_name) + @attributes[attr_name] + end + + private + # Handle *_before_type_cast for method_missing. + def attribute_before_type_cast(attribute_name) + read_attribute_before_type_cast(attribute_name) + end + end + end +end -- cgit v1.2.3