diff options
-rw-r--r-- | activerecord/lib/active_record/mixins/list.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/mixins/touch.rb | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/mixins/list.rb b/activerecord/lib/active_record/mixins/list.rb index a357312105..b75d3d9ca1 100644 --- a/activerecord/lib/active_record/mixins/list.rb +++ b/activerecord/lib/active_record/mixins/list.rb @@ -28,11 +28,9 @@ module ActiveRecord # todo_list.last.move_higher module List def self.append_features(base) - super - base.class_eval do - before_destroy :remove_from_list - after_create :add_to_list_bottom - end + super + base.before_destroy :remove_from_list + base.after_create :add_to_list_bottom end # Moving around on the list 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 |