database design - Rails complex association: has_and_belongs_to_many from two classes to one -
in application, have user
model , artist
model. both users
, artists
should able "follow" multiple artists. i'm not sure how describe relationship, , i'm lost regarding underlying migration.
i've tried having has_and_belongs_to_many :artists
in both classes, , additional has_and_belongs_to_many :users
in artist
, seems messy, , don't know how write migration.
i've looked @ association docs migration; i'm not sure if simpler have third-class , use :through
association, or if need 1 user-to-artist , artist-to-artist, or if 1 additional class enough.
help appreciated, in advance!
Comments
Post a Comment