Created
October 8, 2009 05:30
-
-
Save jackprophesy/204779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Passion | |
module Contact | |
module Timeline | |
# Add universal "columns" to the model | |
def self.included(base) | |
base.send :key, :contact_id, String | |
base.send :key, :timeline_at, Time | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
attr :summary | |
def add_to_timeline(options = {}) | |
@summary = options[:summary] | |
puts "Summary set: " + @summary | |
end | |
end | |
def after_save | |
Feed.create(:summary => "buddy", :contact_id => self.contact_id, :type => self.class, :type_id => self.id) | |
end | |
def after_destory | |
puts 'DESTROY ' + self.class.to_s + self.id.to_s | |
Feed.all(:conditions => {:type => self.class, :type_id => self.id}).each {|a| a.destroy } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment