Class: Commentui::ApplicationController
- Inherits:
-
Object
- Object
- Commentui::ApplicationController
- Defined in:
- app/controllers/commentui/application_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
- #check_commentui_user ⇒ Object
- #commentui_user ⇒ Object
- #record_not_found ⇒ Object
- #render_json_errors(errors, status = :unprocessable_entity) ⇒ Object
Instance Method Details
#check_commentui_user ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/commentui/application_controller.rb', line 17 def check_commentui_user return if commentui_user.present? render_json_errors("Permission denied") end |
#commentui_user ⇒ Object
23 24 25 |
# File 'app/controllers/commentui/application_controller.rb', line 23 def commentui_user @commentui_user ||= Commentui.current_user_lambda.call(self) end |
#record_not_found ⇒ Object
13 14 15 |
# File 'app/controllers/commentui/application_controller.rb', line 13 def record_not_found render_json_errors("Record not found", :not_found) end |
#render_json_errors(errors, status = :unprocessable_entity) ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/commentui/application_controller.rb', line 6 def render_json_errors(errors, status=:unprocessable_entity) errors = [errors] unless errors.instance_of?(Array) render json: { errors: errors }, status: status end |