Class: Devise::Middlewares::Rememberable
- Inherits:
-
Object
- Object
- Devise::Middlewares::Rememberable
- Defined in:
- lib/devise/middlewares/rememberable.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Rememberable
constructor
A new instance of Rememberable.
Constructor Details
#initialize(app) ⇒ Rememberable
Returns a new instance of Rememberable.
4 5 6 |
# File 'lib/devise/middlewares/rememberable.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/devise/middlewares/rememberable.rb', line 8 def call(env) auth = env['warden'] scopes = (auth.request) scopes.each do |scope, token| mapping = Devise.mappings[scope] next unless mapping && mapping.for.include?(:rememberable) user = mapping.to.(token) auth.set_user(user, :scope => scope) if user end @app.call(env) end |