|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
class ReviewsController < ApplicationController
|
|
|
|
|
before_action :set_movie
|
|
|
|
|
before_action :require_signin
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@reviews = @movie.reviews
|
|
|
|
@ -9,6 +10,7 @@ class ReviewsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
def create
|
|
|
|
|
@review = @movie.reviews.new(review_params)
|
|
|
|
|
@review.user = current_user
|
|
|
|
|
if @review.save
|
|
|
|
|
redirect_to movie_reviews_path(@movie), notice: "Thanks for your review!"
|
|
|
|
|
else
|
|
|
|
@ -23,6 +25,6 @@ class ReviewsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def review_params
|
|
|
|
|
params.require(:review).permit(:name, :stars, :comment)
|
|
|
|
|
params.require(:review).permit(:stars, :comment)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|