Hello everyone,
I just read the entire Associations page on the RoR Guide, and I’m
wanting to see if I can run it by the pros to make sure I have it down
right for my particular project. As a first test project I’m doing a
simple Issue Tracker.
The tracker has the following models:
Projects
Tickets
Milestones
Components
Types
Severities
Each Project will have many Tickets
Each Ticket will have one of the following, Milestone, Component,
Type, Severity
From reading the RoR Association Guide I have guessed that this is the
best method using Milestone as the example:
Project: has_many: tickets, has_many: milestones, :through => tickets
Ticket: belongs_to: project, belongs_to: milestone
Milestone: has_many: tickets, has_many: projects, :through => tickets
Would this be the correct associations for have a Project will have
multiple tickets, and each ticket will have exactly one milestone
reference?
The thing that has me confused is that each project can have multiple
milestone, ie: Milestone 1, Milestone 2, etc…but these milestones
will be related to the Project, so in the actual table there may be 5
instances of Milestone 1 but with a different project id.
I’m so lost, lol.