Up until now we have looked at the create
and update
controller action in Rails in the context of using a basic <html>
form tag, <form></form>
.
When you wanted to POST a new movie to your Metube app:
First you made a new
controller-action in your videos
controller. This action was mapped to the GET
route that loaded the new video form from the views/videos/new.html.erb
file with a route that looks like get "/videos/new", to: "videos#new"
in the routes.rb
file.
Looking at the new
action in the videos
controller, it's time to come clean. There was really no reason in the previous Rails CRUD lesson with the new
action that we needed to hand down this instance variable: