Browse Source

Fix require_user! behavior when not logged in (#4604)

master
abcang 7 years ago
committed by Eugen Rochko
parent
commit
e120d09c98
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      app/controllers/api/base_controller.rb

+ 5
- 4
app/controllers/api/base_controller.rb View File

@ -62,10 +62,11 @@ class Api::BaseController < ApplicationController
end
def require_user!
current_resource_owner
set_user_activity
rescue ActiveRecord::RecordNotFound
render json: { error: 'This method requires an authenticated user' }, status: 422
if current_user
set_user_activity
else
render json: { error: 'This method requires an authenticated user' }, status: 422
end
end
def render_empty

Loading…
Cancel
Save