Sha256: 7990a76dfe09d13ca9575b32ce2c1db4abb8dec0ae33e4ac6631f480e1f31092

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

require "devise"

module Identity
  mattr_accessor :devise_modules do
    [
      :database_authenticatable,
      :registerable,
      :recoverable,
      :rememberable,
      :trackable,
      :validatable
    ]
  end

  mattr_accessor(:user_class_name) { "::User" }
  mattr_accessor(:layout) { 'application' }
  mattr_accessor(:auth_routes) { {} }
  mattr_accessor(:active_scope) { :all }

  def self.user_class
    user_class_name.constantize
  end

  def self.controllers
    if Devise.omniauth_providers.any?
      { omniauth_callbacks: "identity/omniauth_callbacks" }
    else
      {  }
    end
  end

  def self.setup
    yield self
  end

  def self.method_missing(name, *args, &block)
    if delegate_to_devise?(name.to_s)
      Devise.public_send(name, *args, &block)
    else
      super
    end
  end

  def self.delegate_to_devise?(name)
    name.in?(%w(omniauth)) ||
    name.ends_with?('=') && Devise.respond_to?(name)
  end

  def self.respond_to_missing?(name, include_private = false)
    (name.to_s.ends_with?('=') && Devise.respond_to?(name, include_private)) || super
  end

end

unless caller.find {|s| s.end_with?("`generate_or_destroy'")}
  require "identity/engine"
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
anadea-identity-0.5.2 lib/identity.rb
anadea-identity-0.5.1 lib/identity.rb
anadea-identity-0.5.0 lib/identity.rb
anadea-identity-0.4.2 lib/identity.rb
anadea-identity-0.4.1 lib/identity.rb
anadea-identity-0.4.0 lib/identity.rb