aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-07-24 00:25:27 -0500
committerJoshua Peek <josh@joshpeek.com>2009-07-30 17:53:59 -0500
commitc2b075bed084a59a674469d09db016aaa3365c2e (patch)
tree1bbeaa283ade2d6dd8d97feb01d0720f37dab1f6 /activerecord/lib/active_record/attribute_methods/before_type_cast.rb
parent2c2ca833a531d825d9b46e501b564a52a8a69358 (diff)
downloadrails-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.rb21
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