This has nothing to do with Rails and parameter parsing; you're producing malformed HTML. The problem is that you're missing quotes around your the value of the value
attribute of your hidden <input>
.
This:
value=<%= params[:q] %>>
needs to be this:
value="<%= params[:q] %>">
Otherwise you're producing something like <input ... value=new year />
where "year" isn't parsed as part of the value
attribute.