aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-15 20:21:05 +0000
committerJon Leighton <j@jonathanleighton.com>2011-12-15 20:45:42 +0000
commit17ad71e5141eaa79bfb4aedc2f3a5b4abfa0baba (patch)
tree5f1fe36db9945b7d4bb3c59eb4ac80e8de0428fb /activerecord/lib/active_record/attribute_methods.rb
parentceb33f84933639d3b61aac62e5e71fd087ab65ed (diff)
downloadrails-17ad71e5141eaa79bfb4aedc2f3a5b4abfa0baba.tar.gz
rails-17ad71e5141eaa79bfb4aedc2f3a5b4abfa0baba.tar.bz2
rails-17ad71e5141eaa79bfb4aedc2f3a5b4abfa0baba.zip
Let AttributeMethods do its own including etc
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 43ab289bdc..650fa3fc42 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -7,6 +7,29 @@ module ActiveRecord
extend ActiveSupport::Concern
include ActiveModel::AttributeMethods
+ included do
+ include Read
+ include Write
+ include BeforeTypeCast
+ include Query
+ include PrimaryKey
+ include TimeZoneConversion
+ include Dirty
+ include Serialization
+ include DeprecatedUnderscoreRead
+
+ # Returns the value of the attribute identified by <tt>attr_name</tt> after it has been typecast (for example,
+ # "2004-12-12" in a data column is cast to a date object, like Date.new(2004, 12, 12)).
+ # (Alias for the protected read_attribute method).
+ alias [] read_attribute
+
+ # Updates the attribute identified by <tt>attr_name</tt> with the specified +value+.
+ # (Alias for the protected write_attribute method).
+ alias []= write_attribute
+
+ public :[], :[]=
+ end
+
module ClassMethods
# Generates all the attribute related methods for columns in the database
# accessors, mutators and query methods.