Additional RESTful actions
suggest changeresources :photos domember doget 'preview'endcollection doget 'dashboard'endend
This creates the following routes in addition to default 7 RESTful routes:
get '/photos/:id/preview', to: 'photos#preview'
get '/photos/dashboards', to: 'photos#dashboard'
If you want to do this for single lines, you can use:
resources :photos doget 'preview', on: :memberget 'dashboard', on: :collectionend
You can also add an action to the /new path:
resources :photos doget 'preview', on: :newend
Which will create:
get '/photos/new/preview', to: 'photos#preview'
Be mindful when adding actions to your RESTful routes, probably you are missing another resource!
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents