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.
精彩评论