I have a Scouts model that requires two actions in addition to the standard REST actions, check_in and check_out. So I have my route as:
resources :scouts do
member do
get 'check_in'
get 'check_out'
end
end
But I need to display the show.html to the user, with a link to check_in the Scout or check_out the scout. In order to utilize the same show.html view and keep only one show action in ScoutsController, I pass ?mode=check_in
or ?mode=check_out
appended to the url to designate this is not a regular show action and thus display "Check In" and "Check Out" links.
I thought about creating a check_in
and check_out
resource, but that doesn't seem to fit the model of REST as checking in/out is an action and not a resource.
Is there a better way to handle this RESTfully?
Update: The mode comes from different users with differing agendas (i.e. workflows). One user may need to show and edit Scout data, while another will only be performing check_in
activities.
But, the user that is performing check_in
activities may need to edit. For example, the user performing check_in
activities may spot an error in Scout data, fix it by editing, and return to their check_in
activity. Passing the mode
allows me to determine the users agenda. Also, adding the mode
allows me to use only one show/edit/etc view and just display the appropriate links based on it.
I could put mode in the session hash. Either way, same result.
The benefit is a very simple user interface (for very simple users).
Seems to me that the Scout is the resource and check_in
and check_out
are the actions. But using the mode seems awkward. But maybe it really is the best way. That's my question.