Sha256: 179efd63b44c0f74b7d8cf37a89b57b04e5a56dcd01fbf4cfe079e48c3ce3473

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

module DqAdmin
  class ApplicationController < ActionController::Base
    protect_from_forgery with: :exception

    before_action :require_admin

    private

    def require_admin
      return if is_devise_page?
      return if user_signed_in?
      not_found
    end

    helper_method :is_devise_page?
    def is_devise_page?
      params['controller'] =~ /[sessions|passwords]/ 
    end

    def not_found
      raise ActionController::RoutingError.new('Not Found')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dq_admin-0.4.3 app/controllers/dq_admin/application_controller.rb
dq_admin-0.4.2 app/controllers/dq_admin/application_controller.rb