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

7. Forms

Stefan Wintermeyer1 
(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 ...

Get Learn Rails 5.2: Accelerated Web Development with Ruby on Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.