search for: participated_incidents

Displaying 1 result from an estimated 1 matches for "participated_incidents".

Did you mean: participated_incident
2013 Feb 08
1
Problem with many to many relationship
...ng to create a many to many relationship between two models. A User can be associated with many Incidents and vice versa. class User < ActiveRecord::Base include ActiveModel::ForbiddenAttributesProtection has_many :incident_participants, foreign_key: "participant_id" has_many :participated_incidents, through: :incident_participants end class Incident < ActiveRecord::Base include ActiveModel::ForbiddenAttributesProtection has_many :incident_participants, foreign_key: "participated_incident_id" has_many :participants, through: :incident_participants end The join table:...