Ruby on Rails Discussions
Two fields associated to the same table
rubyonrails-talk
GoodbyeJava
(GoodbyeJava)
August 8, 2007, 5:23pm
1
you need 2 foriegn keys. Then add the :foriegn_key => :user2_id to has_many and belongs_to
Related topics
Topic
Replies
Views
Activity
One to many ralationships
rubyonrails-talk
8
164
February 1, 2011
Newbie belongs_to question
rubyonrails-talk
1
73
January 5, 2010
Associations with 2 foreign keys
rubyonrails-talk
3
154
February 28, 2012
Simple Association Issue
rubyonrails-talk
6
198
February 3, 2011
Problem with two foreign keys
rubyonrails-talk
2
121
July 7, 2008