O'Reilly logo

Learn Rails 5.2: Accelerated Web Development with Ruby on Rails by Stefan Wintermeyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Stefan Wintermeyer 2018
Stefan WintermeyerLearn Rails 5.2https://doi.org/10.1007/978-1-4842-3489-1_7

7. Forms

Stefan Wintermeyer
(1)
Bochum, Germany
 
In this chapter, I’ll talk about forms.

The Data-Input Workflow

To understand forms, you need take a look at the data workflow. Understanding it better will help you to understand how forms work.
Here is an example application:
$ rails new testapp
[...]
$ cd testapp
$ rails generate scaffold Person first_name last_name
[...]
$ rails db:migrate
[...]
$ rails server
[...]
Usually you will create forms by using the scaffold. Let’s go through the flow the data.

Request the people#new Form

When you request the http://localhost:3000/people/new URL, the router answers with the following route:
new_person GET    /people/new(.:format)      people#new ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required