私はしばらくこの問題に悩まされてきましたが、スキップし続けます。ここで警官のガイドラインに従って、これを && に変更すると、ルートが壊れます。それらは次を介して私のルートに接続されています:
# Override Error Codes
match '/404', to: 'error#four_oh_four', via: :all
match '/422', to: 'error#four_twenty_two', via: :all
match '/500', to: 'error#five_hundred', via: :all
この問題に対してこの警官を無効にすることをお勧めしますか、またはこれを調整するより良い方法はありますか?
class ErrorController < ApplicationController
before_filter :ensure_trailing_slash
before_action :load_log_service
def javascript_disabled
@log_service.capture_message(view_context.time_stamp('javascript_disabled'), 'error_scope')
render_error_application_requirements t('system_requirements.minimum_settings.javascript_disabled')
end
def system_requirements
@log_service.capture_message(view_context.time_stamp('system_requirements'), 'error_scope')
render_error_application_requirements t('system_requirements.minimum_settings.system_requirements')
end
def browser_upgrade_required
@log_service.capture_message(view_context.time_stamp('browser_upgrade_required'), 'error_scope')
render_error_application_requirements t('system_requirements.minimum_settings.browser_upgrade_required')
end
def four_oh_four
@log_service.capture_message(view_context.time_stamp('four_oh_four'), 'error_code')
render_error_status_code('Page Not Found', '404', t('system_requirements.response_code.four_oh_four'))
end
# four_twenty_two, five_hundred :: no custom report needed, they are picked up by the sentry gem
def four_twenty_two
render_error_status_code('Application Error', '422', t('system_requirements.response_code.four_twenty_two'))
end
def five_hundred
render_error_status_code('Application Error', '500', t('system_requirements.response_code.five_hundred'))
end
private
def render_error_application_requirements(title)
@title = title
render 'errors/application_requirements', layout: 'errors/application_requirements' and return
end
def render_error_status_code(title, error_code, error_msg)
@title = title
@error_code = error_code
@error_msg = error_msg
render 'errors/status_code', layout: 'errors/status_code', status: @error_code and return
end
def load_log_service
@log_service = LogService.new
end
end