|
|
|
@ -7,6 +7,8 @@ class MoviesController < ApplicationController
|
|
|
|
|
def show
|
|
|
|
|
@movie = Movie.find(params[:id])
|
|
|
|
|
@fans = @movie.fans
|
|
|
|
|
@genres = @movie.genres.order(:name)
|
|
|
|
|
|
|
|
|
|
if current_user
|
|
|
|
|
@favorite = current_user.favorites.find_by(movie_id: @movie.id)
|
|
|
|
|
end
|
|
|
|
@ -43,6 +45,6 @@ class MoviesController < ApplicationController
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def movie_params
|
|
|
|
|
params.require(:movie).permit(:title, :description, :rating, :released_on, :total_gross, :director, :duration, :image_file_name)
|
|
|
|
|
params.require(:movie).permit(:title, :description, :rating, :released_on, :total_gross, :director, :duration, :image_file_name, genre_ids: [])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|