Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhh committed Dec 8, 2004
1 parent fdd2859 commit 3fef016
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 3 additions & 5 deletions activerecord/lib/active_record/mixins/list.rb
Expand Up @@ -28,11 +28,9 @@ module Mixins
# 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
Expand Down
9 changes: 5 additions & 4 deletions activerecord/lib/active_record/mixins/touch.rb
Expand Up @@ -17,12 +17,13 @@ module Mixins
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
Expand Down

0 comments on commit 3fef016

Please sign in to comment.