camerican / Help-Desk

Help Desk for NYCDA Projects
1 stars 1 forks source link

Only render certain routes via :resources #5

Closed camerican closed 7 years ago

camerican commented 7 years ago

If we wish to render only certain routes via Rails' resources method, we can pass through an options hash that includes the exceptions we wish to omit (or a list of the routes we wish to include).

resources :posts, except: [:destroy,:update,:create,:new,:edit]

# or
resources :posts, only: [:index, :show]

Either of the above resources should result in the same resultant routes.

references: [StackOverflow]