resources :photos do member do get 'preview' end collection do get 'dashboard' end end
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 do get 'preview', on: :member get 'dashboard', on: :collection end
You can also add an action to the
resources :photos do get 'preview', on: :new end
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!