Module: MultiModelWizard::CookieStore
- Extended by:
- ActiveSupport::Concern
- Included in:
- RedisCookieStore, Wizard
- Defined in:
- lib/multi_model_wizard/cookie_store.rb
Constant Summary collapse
- EXPIRATION =
1.hour
Instance Method Summary collapse
-
#delete_cookie(key) ⇒ Object
This method is used to delete the session cookie from the browser.
-
#get_signed_cookie(key) ⇒ Object
This method is used to retrieve the session cookie from the browser.
-
#set_signed_cookie(attributes) ⇒ Object
This method is used to set the session cookie on the browser EXAMPLE: set_signed_cookie(key: ‘multi_model_wizard_form’, value: { hello: ‘world’ }).
Instance Method Details
#delete_cookie(key) ⇒ Object
This method is used to delete the session cookie from the browser
31 32 33 |
# File 'lib/multi_model_wizard/cookie_store.rb', line 31 def (key) .delete(key.to_sym) end |
#get_signed_cookie(key) ⇒ Object
This method is used to retrieve the session cookie from the browser
26 27 28 |
# File 'lib/multi_model_wizard/cookie_store.rb', line 26 def (key) .signed[key.to_sym] end |
#set_signed_cookie(attributes) ⇒ Object
This method is used to set the session cookie on the browser EXAMPLE: set_signed_cookie(key: ‘multi_model_wizard_form’, value: { hello: ‘world’ })
15 16 17 18 19 20 21 22 23 |
# File 'lib/multi_model_wizard/cookie_store.rb', line 15 def (attributes) .signed[attributes[:key]&.to_sym] = { value: attributes[:value], expires: attributes[:expires] || EXPIRATION.from_now, same_site: attributes[:same_site] || 'None', secure: attributes[:secure] || true, httponly: attributes[:httponly] || true } end |