Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix require_user! behavior when not logged in #4604

Merged
merged 1 commit into from Aug 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/controllers/api/base_controller.rb
Expand Up @@ -62,10 +62,11 @@ def current_user
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
Expand Down