Week 2 Quiz
1. Name all the 7 (or 8) routes exposed by the resources keyword in the routes.rb file. Also name the 4 named routes, and how the request is routed to the controller/action.
* 7 routes: *
resources :posts, except: [:destroy]
* 4 named routes: *
* The Rails router recognizes URLs and dispatches them to a controller's action. *
If you require postspath with GET, the request routed to postscontroller.rb/index
If you require postspath with POST, the request routed to postscontroller.rb/create
2. What is REST and how does it relate to the resources routes?
By default, Rails creates routes for the seven default actions (index, show, new, create, edit, update, and destroy) for every RESTful route in your application. You can use the :only and :except options to fine-tune this behavior.
The :only option tells Rails to create only the specified routes.
The :except option specifies a route or list of routes that Rails should not create.
3. What's the major difference between model backed and non-model backed form helpers?
<%= form_for @category do |f| %> <%= f.label :name %> <%= f.text_field :name %> <% end %>
Only specifications is been defined in obj, model backed form helpers can be used. The non-model backed form do this manually, this problem does not exist.