Rails - one model with two associations
I have the model Member that contains all informations about the registered member on my site. Then I have the model Message which contains 2 columns (actually 3 with id ): - member_id - message_from In the table Messages are stored IDs of user, how chatting together - when the member A send message to member B , so in the column member_id is saved ID of person A and into the column message_from ID of the person B . My current associations looks like: class Member < ActiveRecord::Base has_many :messages_from end class Message < ActiveRecord::Base belongs_to :member end I don't know, how could