diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index 3e6fbac9..21321caf 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -27,7 +27,7 @@ class SubscriptionsController < ApplicationController skip_authorization respond_to do |format| format.html { redirect_to request_for_comments_url, alert: t('subscriptions.subscription_not_existent') } - format.json { head :internal_server_error } + format.json { render json: {message: t('subscriptions.subscription_not_existent')}, status: :not_found } end else authorize! @@ -35,12 +35,12 @@ class SubscriptionsController < ApplicationController if @subscription.destroy respond_to do |format| format.html { redirect_to request_for_comment_url(rfc), notice: t('subscriptions.successfully_unsubscribed') } - format.json { head :destroyed } + format.json { render json: {message: t('subscriptions.successfully_unsubscribed')}, status: :ok} end else respond_to do |format| format.html { redirect_to request_for_comment_url(rfc), :flash => { :danger => t('shared.message_failure') } } - format.json { head :internal_server_error } + format.json { render json: {message: t('shared.message_failure')}, status: :internal_server_error} end end end