Tuesday, June 10, 2014

Notes - Rails Tutorial Chapter 7.2.2

form_for helper method, which takes in an Active Record object and constructs a form using the object’s attributes. <%= form_for %>

These name values allow Rails to construct an initialization hash (via the params variable) for creating users using the values entered by the user
the Rails code:
<label for="user_name">Name</label>
<input id="user_name" name="user[name]" type="text" />
---------------------------------------------------------------
the html output:
<input id="user_name" name="user[name]" - - - />

Recall from Section 7.1.2 that adding resources :users to the routes.rb file (Listing 7.3) automatically ensures that our Rails application responds to the RESTful URLs from Table 7.8

No comments:

Post a Comment