Ruby On Rails Lesson
The Form HTML
As indicated by Figure 7.12, the signup page now renders properly, indicating that the form_for code in Listing 7.17 is producing valid HTML. If you look at the HTML for the generated form (using either Firebug or the ‘‘view page source’’ feature of your browser), you should see markup as in Listing 7.20. Although many of the details are irrelevant for our purposes, let’s take a moment to highlight the most important parts of its structure.
(Here I’ve omitted some HTML related to the authenticity token, which Rails automatically includes to thwart a particular kind of attack called a cross-siterequest forgery (CSRF). See the Stack Overflow entry on the Rails authenticity token if you’re interested in the details of how this works and why it’s important.)
We’ll start with the internal structure of the document. Comparing Listing 7.17 with Listing 7.20, we see that the Embedded Ruby
produces the HTML