Skip to content

Commit

Permalink
Refactoring do método FriendRequestsController on issue #69
Browse files Browse the repository at this point in the history
  • Loading branch information
belamartinsm committed Mar 28, 2023
1 parent 8c6dc92 commit 02f722a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/friend_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def create
end

def accept
@friend_request = FriendRequest.find_by(id: params[:id], receiver: current_user, status: 'pending')
@friend_request = current_user.received_friend_requests.pending.find_by(id: params[:id])
if @friend_request
@friend_request.accept
redirect_to current_user, notice: 'Solicitação de amizade aceita!'
Expand Down

0 comments on commit 02f722a

Please sign in to comment.