diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-07-24 00:25:27 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-07-30 17:53:59 -0500 |
commit | c2b075bed084a59a674469d09db016aaa3365c2e (patch) | |
tree | 1bbeaa283ade2d6dd8d97feb01d0720f37dab1f6 /activerecord/lib/active_record/attribute_methods/before_type_cast.rb | |
parent | 2c2ca833a531d825d9b46e501b564a52a8a69358 (diff) | |
download | rails-c2b075bed084a59a674469d09db016aaa3365c2e.tar.gz rails-c2b075bed084a59a674469d09db016aaa3365c2e.tar.bz2 rails-c2b075bed084a59a674469d09db016aaa3365c2e.zip |
Concernify AR AttributeMethods
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods/before_type_cast.rb')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/before_type_cast.rb | 21 |
1 files changed, 21 insertions, 0 deletions
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 |