You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
423 B

class FavoritesController < ApplicationController
before_action :require_signin
before_action :set_movie
def create
@movie.favorites.create!(user: current_user)
redirect_to @movie
end
def destroy
favorite = current_user.favorites.find(params[:id])
favorite.destroy
redirect_to Movie.find(params[:movie_id])
end
def set_movie
@movie = Movie.find_by!(slug: params[:movie_id])
end
end