Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def self.append_features(base) # :nodoc: super debugger puts "zOMG " + self.to_s + ", " + base.to_s base.instance_eval do def store_create create_activity("Create") end def store_update create_activity("Update") end def create_activity(action) debugger puts self.changes().to_s activity = Activity.new(:actionable => self, :action => action, :site => self.site_id ) self.changes().each do |c| Change.new(:activity => activity, :attribute => c[0], :value_from => c[1][0], :value_to => c[1][1]) end end end base.before_validation :store_create base.before_create :store_create base.before_update :store_update end
This paste will be private.
From the Design Piracy series on my blog: