Class: MultiModelWizard::Config
- Inherits:
-
Object
- Object
- MultiModelWizard::Config
- Defined in:
- lib/multi_model_wizard/config.rb
Constant Summary collapse
- FORM_KEY =
The form key is what is used a the key in the session cookies This can be changed in the intitializer file. This key is also what is used as part of the redis key value pair if redis is configured.
'multi_model_wizard_form'.freeze
Instance Attribute Summary collapse
-
#form_key ⇒ Object
Returns the value of attribute form_key.
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#location ⇒ Object
Location tells the gem where to put your form data between form steps The default is session cookies in the browser.
-
#redis_instance ⇒ Object
The configured redis instance.
-
#store_in_cookies? ⇒ Boolean
Logical methods to determine where the gem should store form data.
-
#store_in_redis? ⇒ Boolean
Logical methods to determine where the gem should store form data.
Constructor Details
Instance Attribute Details
#form_key ⇒ Object
Returns the value of attribute form_key.
9 10 11 |
# File 'lib/multi_model_wizard/config.rb', line 9 def form_key @form_key end |
#store ⇒ Object
Returns the value of attribute store.
9 10 11 |
# File 'lib/multi_model_wizard/config.rb', line 9 def store @store end |
Instance Method Details
#location ⇒ Object
Location tells the gem where to put your form data between form steps The default is session cookies in the browser
32 33 34 |
# File 'lib/multi_model_wizard/config.rb', line 32 def location store[:location] end |
#redis_instance ⇒ Object
The configured redis instance. This is should be set in the initializer. A redis instance is only needed if you are going to use redis to store. Redis is great to use when you have a bigger/longer wizard form. Session cookies max size is 4k, so if the size is over that, consider switching to redis store
Session cookies are still used even when using redis as the store location A key and a uuid is stored on the browser session cookie That uuid is used as the key in redis to retrieve the form data to the controller
26 27 28 |
# File 'lib/multi_model_wizard/config.rb', line 26 def redis_instance store[:redis_instance] end |
#store_in_cookies? ⇒ Boolean
Logical methods to determine where the gem should store form data
42 43 44 |
# File 'lib/multi_model_wizard/config.rb', line 42 def store[:location] =! :redis end |
#store_in_redis? ⇒ Boolean
Logical methods to determine where the gem should store form data
37 38 39 |
# File 'lib/multi_model_wizard/config.rb', line 37 def store_in_redis? store[:location] == :redis end |