I use Rails 3.2.8 to create a “product suite” creator that reflects the Google Analytics custom profile builder. For example, a user can define a set of products as follows:
(Category = 'Printers') and ((Name contains “Wireless”) or (Name contains “Wifi”))
My product data is stored in Postgres (9.1.4), using the HStore column to store the dynamic attributes of the product. I created a form that can build a query using Arel, but I adhered to the following requirements:
1. The query must be serialized into a database. I can save the .to_sql line, but then stuck with ...
2. I should be able to restore the user form for later editing, since these are not one-time searches, but general queries.
How can I serialize so that I can easily restore a user request?
source
share