Sha256: 9bab981184acb22c7934cf58c63f207ec9fac9f6bca3795f827a497c564e3f1a

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

class ErrMerchant::ErrorsController < ::ApplicationController
  ErrMerchant.skip_filters.each do |filter_type, filters|
    send(:"skip_#{filter_type}_action", *filters) if filters.any?
  end
  skip_forgery_protection(raise: false)

  ERRORS = {
    internal_server_error: 500,
    not_found: 404,
    conflict: 409,
    unprocessable_entity: 422,
    method_not_allowed: 405,
    not_implemented: 501
  }.freeze

  ERRORS.each do |e, status_code|
    define_method e do
      respond_to do |format|
        format.html { render "template", locals: { status_code: status_code }, layout: ErrMerchant.layout, status: e }
        format.any { head e }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
err_merchant-0.7.1 app/controllers/err_merchant/errors_controller.rb
err_merchant-0.7.0 app/controllers/err_merchant/errors_controller.rb