Reputation: 325
I got an issue converting form params to string of keys and values and then convert it to hash to use this hash as redirect params later.
Everything works fine about one-value params, but I have 2 sets of checkbox there and I am not sure how to handle these checkboxes.
I use something like:
search_params.concat("categories=[#{params[:categories].map {|a| %Q('#{a}')}.join(', ')}]")
and to add checkboxes to string and then
Hash[last_search.sub('?', '').scan /([^=]+)=([^&]+)[&$]/]
Above statement to get all redirect params as hash.
As already said, this works perfect but skips all the 'key: array' pairs, so I can not check for these params in my form after redirect.
Please help me understand how to handle it or how to do it in different and better way.
Upvotes: 0
Views: 876
Reputation: 644
I think you can avoid converting params to hash and back by passing hash to redirect_to
Passing parameters in rails redirect_to
Upvotes: 1