etc
etc

Reputation: 565

Rails RESTful routing with security in mind

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

Answers (1)

zeantsoi
zeantsoi

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

Related Questions