Skip to content

Commit

Permalink
Refactoring do método favorite #66
Browse files Browse the repository at this point in the history
  • Loading branch information
linasdias committed Mar 28, 2023
1 parent dd3a35e commit fdb278a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/controllers/games_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ def destroy

def favorite
@game = Game.find(params[:id])
if current_user.favorite_games.include?(@game)
current_user.favorite_games.delete(@game)
if current_user.favorite_games.delete(@game)
flash[:notice] = "Game removed from favorites."
else
current_user.favorite_games << @game
Expand Down

0 comments on commit fdb278a

Please sign in to comment.