Reputation: 687
I want to get params of query without replacing + to " ". By default, Rails parse + like space.
Example /query?p=abc+abc
params[:p] = 'abc abc', not 'abc+abc'
How to get param without escaping?
Yes, I can do .gsub(/[ ]/, '+')
, but how to get original params before rails unescape them?
Upvotes: 3
Views: 1675
Reputation: 19879
I'm not sure that's possible. The same code that converts plus to space also handles decoding %NN
characters as well. You can get the raw query string (for a GET request) using request.query_string
. It will return something like this: one=two+three&four=five+six
.
Upvotes: 2