From the course: Ruby on Rails 5 Essential Training
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Create action: New - Ruby on Rails Tutorial
From the course: Ruby on Rails 5 Essential Training
Create action: New
- [Voiceover] Now that we understand the basics of forms, 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 we can fill out and submit to the Create action. Create action handles the form processing. Let's focus on the New action in this movie. Let's begin by adding a link from the Index template to our New action. You can see, I already have the link here for Add New Subject. Let's go and actually add the code that we need to make that work. Inside my Index template, here's my Add New Subject, and right now, I just have a placeholder. Now we could just write out the URL for that. It's subjects slash new. That's the restful route that we created for this. But it's better if we can use the route helper, the resourceful route helper that we talked about at the end of the last chapter. So what that would be here is new underscore subject…
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
-
-
-
-
-
-
-
-
-
-
Read action: Index6m 31s
-
Read action: Show5m 22s
-
Form basics5m 13s
-
Create action: New4m 54s
-
Create action: Create5m 27s
-
Strong parameters6m 33s
-
Update actions: Edit/update7m 53s
-
Delete actions: Delete/destroy7m 11s
-
Flash hash7m 28s
-
Challenge: Pages and sections CRUD1m 43s
-
Solution: Pages and sections CRUD7m 38s
-
-
-
-
-
-
-
-
-