# Link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/link-to-remote/150893>\
**Category:** Rails\
**Created:** [October 14, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/link-to-remote/150893 "2008-10-14T19:25:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [October 14, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/link-to-remote/150893/1 "2008-10-14T19:25:26Z")

</div>

I have a link\_to\_remote that I am hoping will be able to slide up and  
down a particaular div, my issue is that I cannot get all the callbacks  
to work together. Here is what I have:

\<%= link\_to\_remote( ‘S’, :url =\> { :action =\> ‘show\_users’,  
:letter =\> ‘S’, :company\_id =\> x.primary\_account\_id},  
:update =\> @company\_title.name,  
:before =\> ‘new Effect.toggle(’’ + @company\_title.name + ‘’,  
‘slide’);’,  
:complete =\> ‘new Effect.toggle(’’ + @company\_title.name + ‘’,  
‘slide’);’) -%\>

Which doesnt work at all. If I take out the :before it works. .  
.somewhat, not the way that I want but works, none the less. How do you  
combine all the callbacks into a single link\_to\_remote? I realize that I  
am propbably missing {} somewhere, but I cannot find any good  
documention on this anywhere. Thanks,

-S

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [October 14, 2008, 7:40pm UTC](https://www.ruby-forum.com/t/link-to-remote/150893/2 "2008-10-14T19:40:08Z")

</div>

On 14 Oct 2008, at 18:25, Shandy N. wrote:

> ‘slide’);’,  
> I think there’s an extra ’ in there.

:before =\> “new Effect.toggle(’#{@company\_title.name}’,‘slide’);”,

is considerably easier to read. you should also be careful that the  
comany name does have a ’ in it (and be aware that not all characters  
are legal in dom ids, so you could make the browser freak out.

Fred

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [October 14, 2008, 7:55pm UTC](https://www.ruby-forum.com/t/link-to-remote/150893/3 "2008-10-14T19:55:56Z")

</div>

Frederick C. wrote:

> On 14 Oct 2008, at 18:25, Shandy N. wrote:  
> :before =\> “new Effect.toggle(’#{@company\_title.name}’,‘slide’);”,  
> Fred

I changed it but it is still not working. When I look at the source I  
see the Ajax for the OnComplete but not anything for the :before  
callback.
