Passing hash as values in hidden_field_tag

Posted by funkymunky on Stack Overflow See other posts from Stack Overflow or by funkymunky
Published on 2010-03-24T07:07:25Z Indexed on 2010/03/24 7:13 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

I am trying to pass some filters in my params through a form like so:

hidden_field_tag "filters", params[:filters]

For some reason the params get changed in the next page. For example, if params[:filters] used to be...

"filters"=>{"name_like_any"=>["apple"]} [1]

...it gets changed to...

"filters"=>"{\"name_like_any\"=>[\"apple\"]}" [2]

note the extra quotations and backslashes in [2] when compared to [1].

Any ideas? I'm attempting to use this with searchlogic for some filtering, but I need it to persist when I change change objects in forms. I would prefer not to have to store it in session.

© Stack Overflow or respective owner

Related posts about hidden-field

Related posts about hash