From 17ad71e5141eaa79bfb4aedc2f3a5b4abfa0baba Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 15 Dec 2011 20:21:05 +0000 Subject: Let AttributeMethods do its own including etc --- .../lib/active_record/attribute_methods.rb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'activerecord/lib/active_record/attribute_methods.rb') 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 attr_name 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 attr_name 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. -- cgit v1.2.3