about summary refs log tree commit diff
path: root/app/controllers/api/base_controller.rb
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2017-08-15 21:14:12 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-08-15 14:14:12 +0200
commite120d09c982d0108bdcdb3dd4d3800870b9e3f8c (patch)
tree93d83c2659bf4784dc1a85f97bab578bc6e47565 /app/controllers/api/base_controller.rb
parent4fcbb1f8385dbcb0ca0e3b6127b75c9485243367 (diff)
Fix require_user! behavior when not logged in (#4604)
Diffstat (limited to 'app/controllers/api/base_controller.rb')
-rw-r--r--app/controllers/api/base_controller.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb
index 105a2859d..6ede63c79 100644
--- a/app/controllers/api/base_controller.rb
+++ b/app/controllers/api/base_controller.rb
@@ -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