Class: Warden::CookieSession::DefaultWrapper
- Inherits:
-
Object
- Object
- Warden::CookieSession::DefaultWrapper
- Defined in:
- lib/warden/cookie_session/default_wrapper.rb
Instance Method Summary collapse
- #fetch_record(key) ⇒ Object
-
#initialize(klass = nil) ⇒ DefaultWrapper
constructor
A new instance of DefaultWrapper.
- #serialize_record(record) ⇒ Object
- #validate_record(record, salt) ⇒ Object
Constructor Details
#initialize(klass = nil) ⇒ DefaultWrapper
Returns a new instance of DefaultWrapper.
5 6 7 |
# File 'lib/warden/cookie_session/default_wrapper.rb', line 5 def initialize(klass = nil) @klass = klass end |
Instance Method Details
#fetch_record(key) ⇒ Object
14 15 16 |
# File 'lib/warden/cookie_session/default_wrapper.rb', line 14 def fetch_record(key) @klass.find(key.first) end |
#serialize_record(record) ⇒ Object
9 10 11 12 |
# File 'lib/warden/cookie_session/default_wrapper.rb', line 9 def serialize_record(record) # like in https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb [record.to_key, record.authenticatable_salt] end |
#validate_record(record, salt) ⇒ Object
18 19 20 21 |
# File 'lib/warden/cookie_session/default_wrapper.rb', line 18 def validate_record(record, salt) # like in https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb record if record && record.authenticatable_salt == salt end |