Sha256: e6a1a9e4a1c109069b94ba9981a88f504a70ce1018bc613280dde5d1234b0a98

Contents?: true

Size: 553 Bytes

Versions: 1

Compression:

Stored size: 553 Bytes

Contents

class ErrMerchant::ErrorsController < ApplicationController
  skip_authorization_check if defined?(::CanCan)
  
  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}, :status => e }
        format.any { head e }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
err_merchant-0.1.1 app/controllers/err_merchant/errors_controller.rb