From the course: Ruby on Rails 6 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create action: New

Create action: New - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Create action: New

- [Narrator] Now that we understand form basics, we're ready to implement the create actions in our controller. The create part of CRUD is made up of two standard actions, new and create, and they work together. The new action displays a web form that a user can fill out and submit to the create action. The create action handles the form processing, and submits the record to the database. Let's focus on the new action in this movie. Let's begin by adding a link in the index template to take us to that new action. So here on the index dot html dot erb template, you can see I have a placeholder for add new subject. I'm going to change this action. You can make it a string, a hash, or you can use the restful route url helper. That's what I'm going to do here. The route helper is going to be called new underscore subject underscore path. Notice that it's singular because I'm still talking about one subject, I'm creating one…

Contents