I have an Appointment model, which can be created via different routes (from Tutor or from Student). I would like to pass ID of the tutor or student to a appointments#new action.
Should I have POST request to push ids to appointment form, or should I use GET request to create a new form. If I should do the latter, then what would be the RESTful way to do it?
Thank you.
It sounds like you’ll want to GET rather than POST because you’re presenting a form, rather than immediately creating the record. I would make appointment a nested resource under both tutor and student in your routes.rb file, so you’ll get the tutor or student ID that way.
The student or tutor ID will get to the params for the AppointmentController #new and #create actions from the URL components, so you won’t need to store those IDs form fields or anything like that.