I have two tables created in a many-to-many relationship: Incidents and Users. When the user is logged in and browsing the page / incidents (index), I want to show all the incidents with which they are associated. Unfortunately, the following error occurs:
Could not find table 'incidents_users'
It seems the rails are looking for the tables "incidents_users" when I actually created the table "users_incidents". "users_incidents" just contains user_id and event_id.
Am I missing something obvious? I am relatively new to rails, so the problem may be something simple that I missed.
Here is the relevant section incidents_controller.rb
Here is the relevant index.html.erb section
<% for incident in @incidents %> <tr> <td><%=h incident.other_id %></td> <td><%=h incident.title %></td> <td><%= link_to 'Show', [@customer, incident] %></td> <td><%= link_to 'Edit', edit_customer_incident_path(@customer, incident) %></td> <td><%= link_to 'Destroy', [@customer, incident], :confirm => 'Are you sure?', :method => :delete %></td> </tr> <% end %>
Thanks! Please let me know if further information is helpful.
source share