Reputation: 43
I am trying to create my first database in rails that allows me to store data about events.
Assume I have information about the event, the venue(s), and the band(s).
Every event should have at least one venue and band but could possibly have more than one of each. Each band can be at more than one event. Each venue can host more than one event.
It seems like "has_many :through" using the "Event" as the ":through" would be the appropriate relationship IF there were only one band/venue pair per event.
So what can I do if there can be multiple bands and multiple venues per event?
Thanks in advance.
Upvotes: 0
Views: 30
Reputation: 1923
You will have to create tables events_venues
and events_bands
and use has_and_belongs_to_many
to build the relationship. For more details, please read the railscasts tutorial here:
Upvotes: 1