Module: AnyLogin::Provider::Devise::Controller

Defined in:
lib/any_login/providers/devise.rb

Constant Summary collapse

DEFAULT_SIGN_IN =
proc do |loginable|
  reset_session
   Controller.mapping_key, loginable
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.any_login_current_user_methodObject



12
13
14
# File 'lib/any_login/providers/devise.rb', line 12

def self.
  @@any_login_current_user_method ||= "current_#{mapping_key}".to_sym
end

.mapping_keyObject



16
17
18
# File 'lib/any_login/providers/devise.rb', line 16

def self.mapping_key
  @@mapping_key ||= ::Devise.mappings.detect {|_key, mapping| mapping.class_name == AnyLogin.klass.name }.first
end

Instance Method Details

#any_login_sign_inObject



20
21
22
23
24
25
26
27
# File 'lib/any_login/providers/devise.rb', line 20

def 
  @loginable = AnyLogin.klass.find(user_id)

   = AnyLogin. || DEFAULT_SIGN_IN
  instance_exec(@loginable, &)

  redirect_to main_app.send(AnyLogin.)
end