Link_to question

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
http://api.rubyonrails.com/classes /ActionView/Helpers/UrlHelper.html
#M000332

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!

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

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