Sha256: afc0f9d597ab122281918f1407e8eaabc5305c4e9ab5646cac1cb58e5771aa1c

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

module CMS
  module Rescue
    extend ActiveSupport::Concern

    included do
      skip_filter *_process_action_callbacks.map(&:filter), only: [:render_404, :render_500]

      rescue_from Exception, with: :render_500 unless Rails.env.development?
    end

    def render_404
      render file: 'public/404.html', status: 404, layout: false
    end

    def render_500(exception = nil)
      cms_logger exception
      self.response_body = nil # make sure that there is no DoubleRenderError
      render file: 'public/500.html', status: 500, layout: false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin_cms-0.1.1 app/controllers/concerns/cms/rescue.rb
rails_admin_cms-0.0.9 app/controllers/concerns/cms/rescue.rb