I have a model named User, and the mysql table is users.
Every user can have many friends. of course, every friend is a user.
So, it’s a relationship from user to user.
how to model this?
User has_and_belongs_to_may :users?
then how to define the table ‘users_users’ for this relationship.
Use the has_and_belongs_to_many :join_table option and name it something
Next, the Friendship concept in a social app might be too important to
its join table. “Friends since 2008”, “BFF”, “sworn enemies”, etc. Maybe
joining table should be a Model of its own. Then User gets…
has_many :users, :through => :friends
…roughly. Can anyone spot what my association is missing?