@ -11,4 +11,10 @@ class MoviesController < ApplicationController
def edit
@movie = Movie.find(params[:id])
end
def update
movie_params = params.require(:movie).permit(:title, :description, :rating, :released_on, :total_gross)
@movie.update(movie_params)
redirect_to @movie
@ -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"