Mastering Rails Forms Episode 3: Form Builders

Posted in Development, Frameworks on December 18, 2008

Mastering Rails Forms Episode 3: Form Builders

Rails applications often contain many different forms, leading to lots of repetitive code. Reading and maintaining that code slows you down. In this episode, we’ll create a form builder to clean up our form code, and add some useful features along the way. Having all the form markup in one place means you can easily change the style of every form in your application. You’ll learn how to:

  • write a custom form builder
  • decorate standard form helpers with custom markup and style
  • handle field-specific options, such as required fields
  • present form field errors consistently in a form builder
  • use existing model validations to mark a field as being required
  • display inline error messages with a form builder

Watch Video

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