Link_to_remote style

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”) %>

Try specifying it within a hash,

{ :class => “foo_style” }

Yeah the two hashes did the trick, thanks.

On Nov 20, 2007 7:03 AM, jimmygoogle [email protected] wrote:

Yeah the two hashes did the trick, thanks.

On Nov 20, 12:26 am, “Chris S.” [email protected] wrote:

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:

<%= 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” } %>

-Chris


Chris S.
Software Architect

What’s Your Idea?