Reputation: 565
If you are not using all of the RESTful routes that are included in a resources route declaration, would it be best practice to declare the routes that you will be using explicitly?
Is there a way to have only certain RESTful routes declared in Rails 4.
Upvotes: 0
Views: 91
Reputation: 26193
The canonical Rails guides have a section on restricting RESTful routes:
You can restrict resourceful routes to include certain actions:
resources :photos, only: [:index, :show]
Or, alternative, you can explicitly exclude them:
resources :photos, except: [:new, :update]
Upvotes: 1