diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-08 16:20:51 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-08 16:20:51 +0000 |
commit | 3fef01649327243d6e811cef2be1707aa30eab62 (patch) | |
tree | 84738be574fc5cf872b95f62dd64430a316a33a7 /activerecord/lib/active_record/mixins/touch.rb | |
parent | fdd28592f622a98c2d4aa5737ebd607e6f251d87 (diff) | |
download | rails-3fef01649327243d6e811cef2be1707aa30eab62.tar.gz rails-3fef01649327243d6e811cef2be1707aa30eab62.tar.bz2 rails-3fef01649327243d6e811cef2be1707aa30eab62.zip |
Cleaned up the class_eval stuff in the new mixins a bit
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@87 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/mixins/touch.rb')
-rw-r--r-- | activerecord/lib/active_record/mixins/touch.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/mixins/touch.rb b/activerecord/lib/active_record/mixins/touch.rb index 74a1737cab..eef041650b 100644 --- a/activerecord/lib/active_record/mixins/touch.rb +++ b/activerecord/lib/active_record/mixins/touch.rb @@ -17,12 +17,13 @@ module ActiveRecord module Touch def self.append_features(base) super - base.class_eval do - before_create :touch_on_create - before_update :touch_on_update + base.before_create :touch_on_create + base.before_update :touch_on_update + + base.class_eval do def touch_on_create - self.created_at = self.updated_at = Time.now + self.updated_at = (self.created_at ||= Time.now) end def touch_on_update |