I have:
<%= button_to 'Remove', remove_attendee_event_path(:event_id => @event.id, :user_id => user.id), :method => :post %>
in one partial and it works fine. Then, in another partial in the same view, I tried to copy/paste this code while changing @event.id to event.id and user.id to current_user.id and it doesn’t work. It tells me RoutingError in Events#index
No route matches {:action=>"remove_attendee", :controller=>"events", :event_id=>4, :user_id=>108}
WHat am i doing wrong?
It’s not the route it is your object. You are padding nil objects to the method.
Check which object is nil with:
Local variables need to be sent to views like this: