Created
January 5, 2011 10:31
-
-
Save ahawkins/766144 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 RadiumCRM | |
module ActsAsActivity | |
def self.included(base) | |
base.class_eval do | |
has_many :activities, :as => :reference, :dependent => :destroy do | |
def create_with_tags(*tags) | |
activity = build :account => @owner.account | |
activity.tag_list.add @owner.class.to_s.underscore | |
activity.tag_list.add(tags) | |
activity.tag_list.add(@owner.state) if @owner.respond_to?(:state) | |
activity.tag_list.add @owner.associated_tags | |
activity.save! | |
activity | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment