I know this is an easy question for a software developer but I'm new to this so I'd really appreciate a little help in designing associations. The basic models I have created are listed below but I'm having a little trouble in linking the location (addresses) information to where it is needed in each of the other models. This is illustrated in two places:
Linking events to a location
My basic idea (from reading the various web posts - thanks) is that rather than using has_and_belongs_to_many I need to create another model called venues which links a location to an event, however all of the online examples seem to have a many-many relationship whereas I want to create a linking model where a location can have many venues (think the screens in a cinema) but an event can have only one venue. How to I write this?
Contact details
I then want to store two additional sets of contact details for each event, the primary contact (contact details public) and the event owner (private for admin use). Again, do I need to create some form of linking model (to store the type of contact) or can I just use habtm?
Event_lists - Have a default venue (which has a location) - Have events (each has a location) - Has an owner (has an address - a location) - Has a primary contact (has an address - a location)
Events - Have a venue (which has a location) - Have a primary contact (a person who has a location for this event) - Have an owner (a person who has a location)
Location - Has an address - Has a latitude and longitude
People - Have an address (which is a link to the location table)