开发者

ActiveRecord and has_many, :through link backs

Is there a simple way to specify a has_many :through relationship where you're linking the same data type? eg. One User has many friends (who are all users). I'd like to be able to store data about the friendship, so has_many :through seems to be the obvious choice, but then you'd have to define two :user_id columns, which of course doesn'开发者_Python百科t really work…


This Self-referential association screencast by Ryan Bates sounds like it was made for your situation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜