Sha256: 6385abf23356f351db5ff140acbab75d6301ce1000bf12efdb00c76544d07b76
Contents?: true
Size: 800 Bytes
Versions: 21
Compression:
Stored size: 800 Bytes
Contents
# frozen_string_literal: true module NeetoCommonsBackend class FailuresController < ApplicationController before_action :set_default_format 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 private def set_default_format request.format = :html unless request.format == :json end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
neeto-commons-backend-1.0.89 | app/controllers/neeto_commons_backend/failures_controller.rb |