Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Created July 16, 2009 15:51
Show Gist options
  • Save jamesgolick/148485 to your computer and use it in GitHub Desktop.
Save jamesgolick/148485 to your computer and use it in GitHub Desktop.
class Creditor
observes :message, :invokes => :use_credits, :on => :create
observes :conversation, :invokes => :use_credits, :on => :create
def use_credits(user)
# use credits
end
end
class Conversation < ActiveRecord::Base
belongs_to :creator, :class_name => "User"
belongs_to :receiver, :class_name => "User"
end
class Message < ActiveRecord::Base
belongs_to :author, :class_name => "User"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment