I am building an E-commerce website on ruby on rails from scratch.

My product belongs to a subcategory which in-turn belongs to a category.

My filters partial include multiple check-boxes for 
category,subcategory,additional_category(Like hand made clothes,factory 
built etc.),lifestyle(relaxed,corporate etc) and cloth_material_type(this 
has around 30 options)

I am sending an array for each of these 5 cases to the backend to search 
through the associations. 


*Now when a non logged in user reloads the page the filters set by user 
resets to default.*


To avoid this I have four options in mind.


*Option 1*. Store the filter values set by the user in the *cookies* which 
is fast.But it might slow down the user's browser.

*Option2* . Store the values in a session using *ActiveRecord::SessionStore* 
gem which will increase the size of session for me to 65K but would slow 
down the application.

*Option 3* .Using jquery modify/create *document.url* options so that every 
filter option gets appended to the document.url and on reload I get the 
parameters set by the user for filtering.But this looks very cumbersome to 
implement.

*Option 4.* Use gems like Rails Temporary data to store the values

Can someone guide me which would the best way to store temporarily these 
details for a non logged in user.


*Edit:*I have opted for storing the values in a session using 
*ActiveRecord::SessionStore* gem but still m worried that it will become 
cumbersome to maintain after some time.


Please suggest as to what Rails based ecommerce applications usually do to 
save this kind of temporary data

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/056063f2-2ff0-4bb2-8155-4b1976c4acd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to