In development /lib/devise/controllerlers/helpers.rb: 35
def devise_group(group_name, opts={})
mappings = "[#{ opts[:contains].map { |m| ":#{m}" }.join(',') }]"
class_eval <<-METHODS, __FILE__, __LINE__ + 1
def authenticate_
unless
mappings =
mappings.unshift mappings.delete(favourite.to_sym) if favourite
mappings.each do |mapping|
opts[:scope] = mapping
warden.authenticate!(opts) if !devise_controller? || opts.delete(:force)
end
end
end
def
warden.authenticate?(scope: mapping)
end
end
def current_
mappings =
mappings.unshift mappings.delete(favourite.to_sym) if favourite
mappings.each do |mapping|
current = warden.authenticate(scope: mapping)
return current if current
end
nil
end
def current_
warden.authenticate(scope: mapping)
end.compact
end
helper_method "current_#{group_name}", "current_#{group_name.to_s.pluralize}", "#{group_name}_signed_in?"
METHODS
end
https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/helpers.rb
:
devise_group , (, current_user),
, warden.authenticate,
def warden
request.env['warden']
end