« Return to Thread: link_to, how do you combine url options and html_options?

Re: link_to, how do you combine url options and html_options?

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View in Thread


James Byrne wrote:
On Jul 7, 3:12�pm, James Byrne <rails-mailing-l...@...>

>
> Presuming that you actually meant the closing ) to be a } I had already
> tried that.  This is what happens:
>
>
> <%=link_to('link here',
>         { new_object_path,
>           :method    =>  :post,
>           :confirm   =>  "Press OK"},
>         :id => "css_id")
> %>
>
>
But we were sooooo close. The actual code has to be this:

<%=link_to('link here',
         { new_object_path,
           { :method    =>  :post,             # note hash within block
             :confirm   =>  "Press OK"
           }
         },
         :id => "css_id")
%>

Obscure does not do this sort of thing justice.
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: link_to, how do you combine url options and html_options?