Module: SessionRememberable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/session_rememberable.rb,
lib/session_rememberable/store.rb,
lib/session_rememberable/methods.rb,
lib/session_rememberable/version.rb
Defined Under Namespace
Modules: ClassMethods
Classes: Store
Constant Summary
collapse
- VERSION =
"0.3.2"
Instance Method Summary
collapse
Instance Method Details
#forget(object, name = nil) ⇒ Object
28
29
30
31
32
|
# File 'lib/session_rememberable/methods.rb', line 28
def forget(object, name=nil)
key = "current_#{name || object.class}".downcase
session[key] = nil
instance_variable_set "@#{key}", nil
end
|
#remember(object, name = nil) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/session_rememberable/methods.rb', line 21
def remember(object, name=nil)
key = "current_#{name || object.class}".downcase
data = object.respond_to?(:id) ? object.id : object.to_s
session[key] = data
instance_variable_set "@#{key}", object
end
|