Mastering Rails Forms Episode 1: Form Essentials

Posted in Development, Frameworks on December 18, 2008

Mastering Rails Forms Episode 1:  Form Essentials

We’ll start by building a search form, and then move on to a form for ordering custom pizzas. The pizza form starts out with a simple text field and checkbox, but ends up with a pull-down menu for the pizza crust type (a one-to-many association) and a group of checkboxes for the pizza toppings (a many-to-many association). You’ll learn how to:

  • use various form helpers to create form fields
  • create forms that are backed by Active Record models using form_for
  • create forms that aren’t backed by a model using form_tag
  • set default and initial values in form fields
  • use form field values in the params hash
  • prevent a common security problem related to mass-assignment
  • create pull-down menus for one-to-many associations
  • use checkboxes for many-to-many associations

Watch Video

Tags: Ruby, Ruby On Rails, Frameworks, The Pragmatic Programmers, Mastering Rails Forms