I have a controller action that pulls a few random events on the index page. There is a link on the page to link to the same controller action with turbolinks this replaces the events partial. when going through the child relationship in the view everything works correctly but if going through the parent relationship and then pulling the child relationship the same controller action is called twice thus the database is not reflective of the view. i.e.
controller
@event_links = @plan.event_links
view
<% @event_links.each do |event_link| %>
<% event = event_link.event %>
<%= event.name %>
<% end %>
The above does not work
But this does:
controller
@events = @plan.events
view
<% @events.each do |event| %>
<%= event.name %>
<% end %>
I have a controller action that pulls a few random events on the index page. There is a link on the page to link to the same controller action with turbolinks this replaces the events partial. when going through the child relationship in the view everything works correctly but if going through the parent relationship and then pulling the child relationship the same controller action is called twice thus the database is not reflective of the view. i.e.
The above does not work
But this does: