Sha256: fdc3aadae356ae719117fa125f27d8a34d4f08600a854804863ead149cb247df

Contents?: true

Size: 584 Bytes

Versions: 3

Compression:

Stored size: 584 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}, :layout => ErrMerchant.layout, :status => e }
        format.any { head e }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
err_merchant-0.3.0 app/controllers/err_merchant/errors_controller.rb
err_merchant-0.2.0 app/controllers/err_merchant/errors_controller.rb
err_merchant-0.1.2 app/controllers/err_merchant/errors_controller.rb