Fix the hidden error: 'private method 'current_user' called for an instance of ErrorsController'
This commit is contained in:
parent
72d8e43b2a
commit
1e7b5a56e4
1 changed files with 9 additions and 9 deletions
|
@ -23,15 +23,6 @@ class ErrorsController < ApplicationController
|
|||
render_error @status
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def render_error(status)
|
||||
respond_to do |format|
|
||||
format.html { render status: }
|
||||
format.json { render status:, json: { status:, name: Rack::Utils::HTTP_STATUS_CODES[status] } }
|
||||
end
|
||||
end
|
||||
|
||||
# Intercept errors in before_action when fetching user or roles
|
||||
# when db is unreachable so we can still display a nice 500 static page
|
||||
def current_user
|
||||
|
@ -45,4 +36,13 @@ class ErrorsController < ApplicationController
|
|||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def render_error(status)
|
||||
respond_to do |format|
|
||||
format.html { render status: }
|
||||
format.json { render status:, json: { status:, name: Rack::Utils::HTTP_STATUS_CODES[status] } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue