Sha256: 69126904b2791770d4e4968173ae099d0bf9daa9bcb898b04e48234cdf98881f

Contents?: true

Size: 1.65 KB

Versions: 14

Compression:

Stored size: 1.65 KB

Contents

require 'devise/rails/routes'
require 'devise/rails/warden_compat'

module Devise
  class Engine < ::Rails::Engine
    config.devise = Devise

    # Initialize Warden and copy its configurations.
    config.app_middleware.use Warden::Manager do |config|
      Devise.warden_config = config
    end

    # Force routes to be loaded if we are doing any eager load.
    config.before_eager_load { |app| app.reload_routes! }

    initializer "devise.url_helpers" do
      Devise.include_helpers(Devise::Controllers)
    end

    initializer "devise.omniauth" do |app|
      Devise.omniauth_configs.each do |provider, config|
        app.middleware.use config.strategy_class, *config.args do |strategy|
          config.strategy = strategy
        end
      end

      if Devise.omniauth_configs.any?
        Devise.include_helpers(Devise::OmniAuth)
      end
    end

    initializer "devise.secret_key" do |app|
      if app.respond_to?(:secrets)
        Devise.secret_key ||= app.secrets.secret_key_base
      elsif app.config.respond_to?(:secret_key_base)
        Devise.secret_key ||= app.config.secret_key_base
      end

      Devise.token_generator ||=
        if secret_key = Devise.secret_key
          Devise::TokenGenerator.new(
            Devise::CachingKeyGenerator.new(Devise::KeyGenerator.new(secret_key))
          )
        end
    end

    initializer "devise.fix_routes_proxy_missing_respond_to_bug" do
      # Deprecate: Remove once we move to Rails 4 only.
      ActionDispatch::Routing::RoutesProxy.class_eval do
        def respond_to?(method, include_private = false)
          super || routes.url_helpers.respond_to?(method)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
deviseOne-1.0.0 lib/devise/rails.rb
devise-3.4.1 lib/devise/rails.rb
devise-3.4.0 lib/devise/rails.rb
devise-3.3.0 lib/devise/rails.rb
devbootsrap-0.0.7 lib/devise/rails.rb
devbootsrap-0.0.6 lib/devise/rails.rb
devbootsrap-0.0.5 lib/devise/rails.rb
devbootsrap-0.0.4 lib/devise/rails.rb
devbootsrap-0.0.3 lib/devise/rails.rb
devbootsrap-0.0.2 lib/devise/rails.rb
devbootsrap-0.0.1 lib/devise/rails.rb
devise-bootstrap-0.0.2 lib/devise/rails.rb
devise-bootstrap-0.0.1 lib/devise/devise/rails.rb
devise-3.2.4 lib/devise/rails.rb