I’ve read through a lot of the documentation and for some reason this still isn’t clear to me.
I have the following setup, a User table, an Event table, and a M2M table Events_Users defined through HABTM relationships on both Users and Events. When a User signs up for an Event on the Event Index or Show page, should it go to the New action in a controller created for Events_Users? If so, should it go to the New action which only serves to pass the parameters to the Create action? Or should it go straight to the Create action?
Any clarification on best practices would be greatly appreciated!
Thanks
I think that one way to do it could be the following:
I would accept the event to have the user as a nested resource this way:
This way you can define a custom action inside the EventsController like this:
And in your form you would have a link_to this action with the current event and the user as a parameter.