I have a double headed question I hope you're able to help me with.
As a bit of context, I have a rails app with a Request model/controller/view setup. It is used for a user to send a request to another user and provides two specific facilities within the update action (trying to stay RESTful) - accept and decline (accept or decline the request).
So my questions are:
First, what is the generally accepted approach setting up the url for accessing a specific type of action (in this case accept or decline are both request updates)? Is it better to pass it using a parameter (e.g.
/requests/11?response=accept
) or to use named routes (e.g./requests/11/accept
)Secondly, if using named routes, how can you determine which named route was responsible for calling the controller? I think you can use
request.url()
or something similar to check the actual url (e.g./requests/11/accept
) but that seems to be a brittle approach to me. I've tried to find other possible ways to do this but can't seem to find a decent way.