Self-referential has_and_belong_to_many

Im having trouble developing the database structure for the following
scenario. I have a table that only contains 2 fields for each
object. It has a admirer_id and an admired_id. There is also a user
table. Now all I want to do is go through the admirers table and for
each admired_id, take the corresponding admirer_id and collect all the
users that have a corresponding user_id to this admirer_id. Im having
trouble setting up the database relationships and how I should go
about this in general. I think this may involve using a self-
referential has_and_belongs_to_many relationship? Any help/advice is
greatly appreciated. Thanks! :wink:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs