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.
15 lines
364 B
15 lines
364 B
class FavoritesController < ApplicationController
|
|
before_action :require_signin
|
|
def create
|
|
@movie = Movie.find(params[:movie_id])
|
|
@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
|
|
end
|