Class: NeetoCommonsBackend::FailuresController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/neeto_commons_backend/failures_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/neeto_commons_backend/failures_controller.rb', line 7

def show
  @status_code = params[:status_code] || "404"
  error = @status_code == "404" ?
    t("neeto_commons_backend.error.not_found") :
    t("neeto_commons_backend.error.generic_error")

  if params[:url]
    Rails.logger.warn "ActionController::RoutingError (No route matches [#{request.method}] /#{params[:url]})"
  end

  respond_to do |format|
    format.json { render json: { error: }, status: @status_code }
    format.any { render status: @status_code }
  end
end