Routing Flashcards
What can you include in your routes.rb file to create various routes with controller actions for a specific model
resources :articles
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?
resources :articles, only: [:index, :new, :create]
resources :articles, except: [:index, :new, :create]
How can you check what routes are available for you in your application?
In terminal run: bundle exec rails routes
How can you make a shorter/cleaner version of the HTML form element, using rails helper methods?
form_for [@article] do |f|
f. label :title
f. text_field :title
f. submit
How do you see the root path of your application?
In your config/routes.rb file:
root controller: :landing, action: :index