Displaying 1 result from an estimated 1 matches for "friends_ibfk_1".
Did you mean:
friends_ibfk_2
2006 Jan 06
2
Re: Some advice on DB modeling
...ds. But the solutions seems not to work for me.
I used same sql:
CREATE TABLE `friends` (
`user_id` int(11) NOT NULL default ''0'',
`friend_id` int(11) NOT NULL default ''0'',
KEY `user_id` (`user_id`),
KEY `friend_id` (`friend_id`),
CONSTRAINT `friends_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES
`users` (`id`),
CONSTRAINT `friends_ibfk_2` FOREIGN KEY (`friend_id`) REFERENCES
`users` (`id`)
)
My user.rb looks like this:
class User < ActiveRecord::Base
has_and_belongs_to_many :friends, :join_table => ''friends'',
:class_...