I am trying to use link_to_remote to update a div tag with some
content. This part works fine. The thing I am having an issue with
is that I am trying to format this link with a ‘class’ tag and it is
being ignored. Can anyone shed some light on this? I have tried
brackets in different places with different options and tried other
variations with no luck. I am guessing my brackets are wrong but
every time I move them my app breaks. Thanks in advance
here is the snippet of code i am using:
<%= link_to_remote(foo.title,
:update =>“show_me”,
:url => {:action => “show”,
:id=>foo.id},
:class => “foo_style”) %>
I think you’ll need to use two hashes, like so:
<%= link_to_remote foo.title,
{ :update =>“show_me”, :url => {:action => “show”, :id=>foo.id} },
{ :class => “foo_style” } %>
And because of Ruby syntactic sugar, you can omit the braces from the
last hash (only), so this is equivalent:
I think you’ll need to use two hashes, like so:
<%= link_to_remote foo.title,
{ :update =>“show_me”, :url => {:action => “show”, :id=>foo.id} },
{ :class => “foo_style” } %>
-Chris
Chris S.
Software Architect
What’s Your Idea?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.