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

lolsob-rspec
abcang 2017-08-15 21:14:12 +09:00 committed by Eugen Rochko
parent 5bd2dcd436
commit efd907e32e
1 changed files with 5 additions and 4 deletions

View File

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