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

Create action: New - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

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…

Contents