search for: mark_updated

Displaying 1 result from an estimated 1 matches for "mark_updated".

2006 Mar 26
5
How to write manage created_on and created_by via mixin?
...#39;t know the terminology for what I''m looking for since what I''m doing has to be relatively common. So, I''ve created a mixin called UserTimestamp.rb: module UserTimestamp def mark_created self.created_on = Time.new self.created_by = @user.user_id end def mark_updated self.updated_on = Time.new self.updated_by = @user.user_id end end And, then I include it and setup the before_create and after_create macros: require ''lib/UserTimestamp.rb'' class Video < ActiveRecord::Base include UserTimestamp before_create :mark_created bef...