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
109
June 13, 2007
multiple foreign keys in one table reference the same table column
rubyonrails-talk
0
241
August 22, 2011
has_many and belongs_to with non-primary foreign keys
rubyonrails-talk
3
192
April 19, 2008
HABTM foreign keys
rubyonrails-talk
0
200
November 29, 2006
Associations with 2 foreign keys
rubyonrails-talk
3
200
February 28, 2012