Complete Lesson 12 Part 2
This commit is contained in:
parent
b6237c5daa
commit
2b32bc0e62
@ -11,4 +11,10 @@ class MoviesController < ApplicationController
|
||||
def edit
|
||||
@movie = Movie.find(params[:id])
|
||||
end
|
||||
def update
|
||||
@movie = Movie.find(params[:id])
|
||||
movie_params = params.require(:movie).permit(:title, :description, :rating, :released_on, :total_gross)
|
||||
@movie.update(movie_params)
|
||||
redirect_to @movie
|
||||
end
|
||||
end
|
||||
|
@ -2,5 +2,6 @@ Rails.application.routes.draw do
|
||||
root "movies#index"
|
||||
get "movies" => "movies#index"
|
||||
get "movies/:id" => "movies#show", as: "movie"
|
||||
patch "movies/:id" => "movies#update"
|
||||
get "movies/:id/edit" => "movies#edit", as: "edit_movie"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user