# Link\_to query string

**URL:** <https://www.ruby-forum.com/t/link-to-query-string/52977>\
**Category:** Rails\
**Created:** [January 22, 2006, 5:52am UTC](https://www.ruby-forum.com/t/link-to-query-string/52977 "2006-01-22T05:52:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew\_clark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@matthew\_clark](https://www.ruby-forum.com/u/matthew_clark)\
**Post date:** [January 22, 2006, 5:52am UTC](https://www.ruby-forum.com/t/link-to-query-string/52977/1 "2006-01-22T05:52:45Z")

</div>

Here’s a simple one I think.

Using link\_to, how do you get multiple fields in the query string?

link\_to(“anchor text”, {:action=\>“neat\_page”, :field\_1=\>“value 1”,  
:field\_2=\>“value 2”})  
-this only gets you field\_1 in the query string

as does this -  
link\_to(“anchor text”, :action=\>“neat\_page”, :field\_1=\>“value 1”,  
:field\_2=\>“value 2”)

link\_to(“anchor text”, :options=\>{:action=\>“neat\_page”, :field\_1=\>“value  
1”,  
:field\_2=\>“value 2”})

- this gets you a querystring of  
"options=actionneat\_pagefield\_1value+1field\_2=value+2

matt
