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
Has and belongs to many with a single table
rubyonrails-talk
0
106
June 13, 2007
multiple foreign keys in one table reference the same table column
rubyonrails-talk
0
235
August 22, 2011
has_many and belongs_to with non-primary foreign keys
rubyonrails-talk
3
164
April 19, 2008
HABTM foreign keys
rubyonrails-talk
0
196
November 29, 2006
Associations with 2 foreign keys
rubyonrails-talk
3
188
February 28, 2012