To display query in the url?

I have simple search method in my posts controller.
When I enter some keyword, it shows results at …posts/search URL.
How can I make it display something like …posts/search?query=this ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs