# Link\_to question

**URL:** <https://www.ruby-forum.com/t/link-to-question/70992>\
**Category:** Rails\
**Created:** [December 17, 2005, 5:42pm UTC](https://www.ruby-forum.com/t/link-to-question/70992 "2005-12-17T17:42:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Phelps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@Scott\_Phelps](https://www.ruby-forum.com/u/Scott_Phelps)\
**Post date:** [December 17, 2005, 5:42pm UTC](https://www.ruby-forum.com/t/link-to-question/70992/1 "2005-12-17T17:42:35Z")

</div>

Man, I was up until 5am coding

Hey, does anyone know how to pass extra paramaters in a link\_to - I  
can’t seem to get the syntax right:

This does NOT work:

- \<%= link\_to 'General',{:action =\> "new\_project",:id =\> @project},{:class =\> "current"},{:foo =\> "bar"}%\> 

But It shows what I am trying to do

It seem it should according to RoR API  
[Peak Obsession](http://api.rubyonrails.com/classes) /ActionView/Helpers/UrlHelper.html  
#M000332

---

<div class="post-metadata">

**Author:** ![Scott\_Phelps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@Scott\_Phelps](https://www.ruby-forum.com/u/Scott_Phelps)\
**Post date:** [December 17, 2005, 6:15pm UTC](https://www.ruby-forum.com/t/link-to-question/70992/2 "2005-12-17T18:15:42Z")

</div>

On Dec 17, 2005, at 11:55 AM, Jakob L. Skjerning wrote:

> link\_to ‘General’, {:action =\> “new\_project”, :id =\> @project, :foo  
> =\> “bar”}, {:class =\> “current”}
> 
> The hash given in the second parameter for link\_to, options, is  
> used to build the URL to link to.

Cool, thanks!

---

<div class="post-metadata">

**Author:** ![Scott\_Phelps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@Scott\_Phelps](https://www.ruby-forum.com/u/Scott_Phelps)\
**Post date:** [December 17, 2005, 5:57pm UTC](https://www.ruby-forum.com/t/link-to-question/70992/3 "2005-12-17T17:57:37Z")

</div>

On Dec 17, 2005, at 17:41, Scott Phelps wrote:

> Hey, does anyone know how to pass extra paramaters in a link\_to - I  
> can’t seem to get the syntax right:
> 
> This does NOT work:  
> \<%= link\_to ‘General’,{:action =\> “new\_project”,:id =\>  
> @project},{:class =\> “current”},{:foo =\> “bar”}%\>

This does:

link\_to ‘General’, {:action =\> “new\_project”, :id =\> @project, :foo  
=\> “bar”}, {:class =\> “current”}

The hash given in the second parameter for link\_to, options, is used  
to build the URL to link to.

–  
Jakob S. - [http://mentalized.net](http://mentalized.net)
