I have a collection table which is having a hash with in different access column. i want to query the records based on this column in my rails '2.3.18' application. But its not working.
What i want to do basically is to update few filter values like adding few values and removing few values in a loop.
col = Collection.find 1598
col.filters
=> {"category_ids"=>["38", "39", "54", "55", "56", "42", "57"], "wb_search"=>
{"material"=>["lace","abc","def"]}, "sort"=>"date", "sold_out"=>false}
>> col.filters.class
=> HashWithIndifferentAccess
How can i query on this filter column like where wb_search material is "lace" etc., and update it to ["lace" , "ghi"] means fetching the record using "lace" and update that column with "lace" , "ghi" (by removing "abc", "def")
i tried the query like this to fetch the records. But its not working.
collections = Collection.where("filters LIKE ?", "%lace%" )(where clause in not
present in rails 2 so its not woking i guess)
collections = Collection.all("filters LIKE ?", "%lace%" )
but none of these queries are not working in my rails 2 app. can some one help to fetch and update on hash with in different access column?