aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-16 14:55:01 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-16 15:09:39 -0600
commit74af9f7fd781501e7f4a4746afd91b1bd5f77ddc (patch)
tree47c95a656a5b0aa0a8a6c72c1282832e13122004 /activerecord/lib/active_record/base.rb
parent88714deb677f598fa40f6e7b61a083a5461d07fd (diff)
downloadrails-74af9f7fd781501e7f4a4746afd91b1bd5f77ddc.tar.gz
rails-74af9f7fd781501e7f4a4746afd91b1bd5f77ddc.tar.bz2
rails-74af9f7fd781501e7f4a4746afd91b1bd5f77ddc.zip
Promote time zone aware attributes to a first class type decorator
This refactoring revealed the need for another form of decoration, which takes a proc to select which it applies to (There's a *lot* of cases where this form can be used). To avoid duplication, we can re-implement the old decoration in terms of the proc-based decoration. The reason we're `instance_exec`ing the matcher is for cases such as time zone aware attributes, where a decorator is defined in a parent class, and a method called in the matcher is overridden by a child class. The matcher will close over the parent, and evaluate in its context, which is not the behavior we want.
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index e4d0abb8ef..0b788ea1f9 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -310,6 +310,8 @@ module ActiveRecord #:nodoc:
include CounterCache
include Locking::Optimistic
include Locking::Pessimistic
+ include Attributes
+ include AttributeDecorators
include AttributeMethods
include Callbacks
include Timestamp
@@ -323,8 +325,6 @@ module ActiveRecord #:nodoc:
include Reflection
include Serialization
include Store
- include Attributes
- include AttributeDecorators
end
ActiveSupport.run_load_hooks(:active_record, Base)