From b0b446aba37b616ecedb9d2450c9b8f629036440 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 8 Jan 2023 21:46:16 -0800 Subject: [PATCH] Fix set_from_slug --- app/controllers/api/v1/parties_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/parties_controller.rb b/app/controllers/api/v1/parties_controller.rb index cb03cc9..9ac5de4 100644 --- a/app/controllers/api/v1/parties_controller.rb +++ b/app/controllers/api/v1/parties_controller.rb @@ -124,7 +124,11 @@ module Api def set_from_slug @party = Party.where('shortcode = ?', params[:id]).first - @party.favorited = current_user && @party ? @party.is_favorited(current_user) : false + if @party + @party.favorited = current_user && @party ? @party.is_favorited(current_user) : false + else + render_not_found_response('party') + end end def set