Double quotes stripped from Params

7 views
Skip to first unread message

Homer Simpson

unread,
Nov 3, 2010, 3:17:26 PM11/3/10
to rubyonra...@googlegroups.com
Rails 2.3.9

I have a form with an input field. If a user enters a phrase surrounded
by quotes the value appears in the params object without the quotes.

For example:

I enter "have fun" in the form.

When I submit and inspect params I see:

{"q"=>"have fun", "Search"=>"Search", "controller"=>"search",
"action"=>"index"}

I look at request.query_string and see:
&q=%22have+fun%22+&Search=Search

Now if I enter the same phrase but have a space in front of it the
quotes come through:

{"q"=>" \"have fun\"", "Search"=>"Search", "controller"=>"search",
"action"=>"index"}

&q=+%22have+fun%22&Search=Search

Can anyone explain why this is and if there is a workaround?

--
Posted via http://www.ruby-forum.com/.

Philip Hallstrom

unread,
Nov 3, 2010, 3:55:09 PM11/3/10
to rubyonra...@googlegroups.com

It's a problem with the version or rack you're using...

https://github.com/rack/rack/commit/dae12e088592ee69545b5f2f81b87f4959859164

Upgrade to a later version that has the above change in it...

-philip

woto

unread,
Nov 12, 2010, 3:33:52 AM11/12/10
to Ruby on Rails: Talk
Reply all
Reply to author
Forward
0 new messages