Routing Flashcards

1
Q

What can you include in your routes.rb file to create various routes with controller actions for a specific model

A

resources :articles

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

If you want to have various routes created for you, but only have a few routes created with specific controller actions, what can you write? What about if you want all the routes, excluding a few?

A

resources :articles, only: [:index, :new, :create]

resources :articles, except: [:index, :new, :create]

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

How can you check what routes are available for you in your application?

A

In terminal run: bundle exec rails routes

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

How can you make a shorter/cleaner version of the HTML form element, using rails helper methods?

A

form_for [@article] do |f|

f. label :title
f. text_field :title
f. submit

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

How do you see the root path of your application?

A

In your config/routes.rb file:

root controller: :landing, action: :index

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