# Link\_to\_remote style

**URL:** <https://www.ruby-forum.com/t/link-to-remote-style/120729>\
**Category:** Rails\
**Created:** [November 20, 2007, 5:30am UTC](https://www.ruby-forum.com/t/link-to-remote-style/120729 "2007-11-20T05:30:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmygoogle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@jimmygoogle](https://www.ruby-forum.com/u/jimmygoogle)\
**Post date:** [November 20, 2007, 5:30am UTC](https://www.ruby-forum.com/t/link-to-remote-style/120729/1 "2007-11-20T05:30:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jimmygoogle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@jimmygoogle](https://www.ruby-forum.com/u/jimmygoogle)\
**Post date:** [November 20, 2007, 6:10am UTC](https://www.ruby-forum.com/t/link-to-remote-style/120729/2 "2007-11-20T06:10:50Z")

</div>

Try specifying it within a hash,

{ :class =\> “foo\_style” }

---

<div class="post-metadata">

**Author:** ![jimmygoogle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@jimmygoogle](https://www.ruby-forum.com/u/jimmygoogle)\
**Post date:** [November 20, 2007, 1:04pm UTC](https://www.ruby-forum.com/t/link-to-remote-style/120729/3 "2007-11-20T13:04:15Z")

</div>

Yeah the two hashes did the trick, thanks.

---

<div class="post-metadata">

**Author:** ![jimmygoogle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@jimmygoogle](https://www.ruby-forum.com/u/jimmygoogle)\
**Post date:** [November 20, 2007, 4:19pm UTC](https://www.ruby-forum.com/t/link-to-remote-style/120729/4 "2007-11-20T16:19:43Z")

</div>

On Nov 20, 2007 7:03 AM, jimmygoogle [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Yeah the two hashes did the trick, thanks.
> 
> On Nov 20, 12:26 am, “Chris S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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” %\>

---

<div class="post-metadata">

**Author:** ![jimmygoogle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@jimmygoogle](https://www.ruby-forum.com/u/jimmygoogle)\
**Post date:** [November 20, 2007, 6:27am UTC](https://www.ruby-forum.com/t/link-to-remote-style/120729/5 "2007-11-20T06:27:47Z")

</div>

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

> **[Intridea | User Experience, User Interface Design, Angular, Backbone, Ruby on...](http://intridea.com/)**
>
> Intridea designs and develops simple, intuitive web and mobile applications to help companies realize the power of social and business collaboration, cloud computing, and next-generation tools for the enterprise. Our developers specialize in Angular,...

What’s Your Idea?
