# How to do link\_to with query parameter AND css class

**URL:** <https://www.ruby-forum.com/t/how-to-do-link-to-with-query-parameter-and-css-class/110100>\
**Category:** Rails\
**Created:** [July 23, 2007, 4:34am UTC](https://www.ruby-forum.com/t/how-to-do-link-to-with-query-parameter-and-css-class/110100 "2007-07-23T04:34:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbellware](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sbellware](https://www.ruby-forum.com/u/sbellware)\
**Post date:** [July 23, 2007, 4:34am UTC](https://www.ruby-forum.com/t/how-to-do-link-to-with-query-parameter-and-css-class/110100/1 "2007-07-23T04:34:26Z")

</div>

Folks,

I’ve been trying to get a number of variations of the following line  
of template code to work:  
\<%= link\_to ‘Show contact details’, :controller =\> ‘people’, :action  
=\> ‘show’, :class =\> ‘actionLink’, :id =\> person %\>

I’ve tied putting curlies around the controller and action as well as  
the class, but I haven’t got it to work. I’ve found some variations  
that will render the css class, but not the query parameter.

Thanks,  
Scott

---

<div class="post-metadata">

**Author:** ![sbellware](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sbellware](https://www.ruby-forum.com/u/sbellware)\
**Post date:** [July 23, 2007, 5:07am UTC](https://www.ruby-forum.com/t/how-to-do-link-to-with-query-parameter-and-css-class/110100/2 "2007-07-23T05:07:30Z")

</div>

Doh! Figured it out:

\<%= link\_to ‘Show contact details’, {:controller =\> ‘people’, :action  
=\> ‘show’, :id =\> person}, {:class =\> ‘actionLink’} %\>
