Routes Flashcards

1
Q

Say you have an article model, how can add routes for all the CRUD actions for your article model and how would you exclude/include specific routes by their action?

A

resources :articles
resources :articles, only: [:index]
resources :articles, except: [:index]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you set the root path for your app?

A

root controller: :landing, action: :index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you automatically redirect visitors to the landing page when there is an routing error? So if a user wants to visit the poop page, what can you add to your routes.rb to redirect them to your landing page?

A

get ‘*path’ => redirect(‘/’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly