Sha256: 52bc2f3e85a026c474ab6fc1401b860b0d39fc49e09e7cf32674ac6c282624cb

Contents?: true

Size: 587 Bytes

Versions: 15

Compression:

Stored size: 587 Bytes

Contents

module Carload
  class ApplicationController < ::ApplicationController
    include Pundit
    rescue_from Pundit::NotAuthorizedError, with: :rescue_not_authorized_error

    protect_from_forgery with: :exception

    private

    def rescue_not_authorized_error
      if Carload.auth_solution == :devise
        if user_signed_in?
          message = I18n.t("carload.error.message.#{params[:controller].split('/').last}_#{params[:action]}")
          redirect_to unauthorized_error_path(message: message)
        else
          authenticate_user!
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
carload-0.5.3 app/controllers/carload/application_controller.rb
carload-0.5.2 app/controllers/carload/application_controller.rb
carload-0.5.1 app/controllers/carload/application_controller.rb
carload-0.5.0 app/controllers/carload/application_controller.rb
carload-0.4.5 app/controllers/carload/application_controller.rb
carload-0.4.4 app/controllers/carload/application_controller.rb
carload-0.4.3 app/controllers/carload/application_controller.rb
carload-0.4.2 app/controllers/carload/application_controller.rb
carload-0.4.1 app/controllers/carload/application_controller.rb
carload-0.4.0 app/controllers/carload/application_controller.rb
carload-0.3.0 app/controllers/carload/application_controller.rb
carload-0.2.2 app/controllers/carload/application_controller.rb
carload-0.2.1 app/controllers/carload/application_controller.rb
carload-0.2.0 app/controllers/carload/application_controller.rb
carload-0.1.0 app/controllers/carload/application_controller.rb