Created
September 2, 2011 06:50
-
-
Save noahhendrix/1188059 to your computer and use it in GitHub Desktop.
Message Example
This file contains hidden or 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
class Message < ActiveRecord::Base | |
belongs_to :recipient, :class => 'User' | |
belongs_to :sender, :class => 'User' | |
end |
This file contains hidden or 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
class User < ActiveRecord::Base | |
has_many :messages, :foreign_key => :recipient_id, :dependent => :destroy | |
has_many :sent_messages, :foreign_key => :sender_id, :class => 'Message', :dependent => :destroy | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment