« 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


Nicholas Henry wrote:

> Based on the documentation:
>
> link_to(name, options = {}, html_options = nil)
>
> I would expect this is what you are looking for (note haven't tested
> it):
>
> link_to "link here", {new_object_path,
>                     :method => :post, :confirm => 'Press OK'), #url
> options
>                     :class => "css_class", :id => "css_id"    #html
> options
>
> HTH,
> Nicholas
>
> 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")
%>


compile error
index.html.erb:86: syntax error
          :method    =>  :post,
                       ^
index.html.erb:87: syntax error
          :confirm   =>  "Press OK"},

index.html.erb:89: syntax error
).to_s); @output_buffer.concat "\n"
                                   ^

--
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?