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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Read action: Index4m 20s
-
(Locked)
Read action: Show4m
-
(Locked)
Adding basic forms to templates4m 51s
-
(Locked)
Create action: New4m 12s
-
(Locked)
Create action: Create5m 5s
-
(Locked)
Using strong parameters to regulate input4m 57s
-
(Locked)
Update actions: Edit and update6m 19s
-
(Locked)
Using partials and helpers to organize code6m 36s
-
(Locked)
Delete actions: Delete and destroy5m 50s
-
(Locked)
Challenge: Pages CRUD1m 23s
-
(Locked)
Solution: Pages CRUD4m 50s
-
(Locked)
-