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