# Can't get simple link\_to\_remote to work

**URL:** <https://www.ruby-forum.com/t/cant-get-simple-link-to-remote-to-work/134644>\
**Category:** Rails\
**Created:** [April 13, 2008, 10:37am UTC](https://www.ruby-forum.com/t/cant-get-simple-link-to-remote-to-work/134644 "2008-04-13T10:37:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 13, 2008, 10:37am UTC](https://www.ruby-forum.com/t/cant-get-simple-link-to-remote-to-work/134644/1 "2008-04-13T10:37:02Z")

</div>

AFAICT, this is all I need to do to get a simple example working:

the should have this:

\<%= javascript\_include\_tag :defaults %\>

My test page view should have a div with an id and the ERB like this:

\<%= link\_to\_remote ‘Click Me’,  
:url =\> {:action =\> ‘show\_time’,  
:update =\> ‘time\_box’} %\>

```
<div id="time_box"></div>

```

The controller for my test page should have this:

def show\_time  
layout false  
render\_text "Time: " + DateTime.now.to\_s  
end

I know there’s various options for several of the details in there, but  
shouldn’t this example work as is?

However, I get no response from this code.

What am I missing?

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 13, 2008, 10:50am UTC](https://www.ruby-forum.com/t/cant-get-simple-link-to-remote-to-work/134644/2 "2008-04-13T10:50:46Z")

</div>

Greg W. wrote:

> AFAICT, this is all I need to do to get a simple example working:

> \<%= link\_to\_remote ‘Click Me’,  
> :url =\> {:action =\> ‘show\_time’,  
> :update =\> ‘time\_box’} %\>

ACK, found it – the } was in the wrong spot.

Now to get a view template to be used for the response. I thought one  
would just automatically get used, but apparently not?

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 13, 2008, 10:52am UTC](https://www.ruby-forum.com/t/cant-get-simple-link-to-remote-to-work/134644/3 "2008-04-13T10:52:18Z")

</div>

Greg W. wrote:

> Greg W. wrote:
> 
> > AFAICT, this is all I need to do to get a simple example working:
> 
> > \<%= link\_to\_remote ‘Click Me’,  
> > :url =\> {:action =\> ‘show\_time’,  
> > :update =\> ‘time\_box’} %\>
> 
> ACK, found it – the } was in the wrong spot.
> 
> Now to get a view template to be used for the response. I thought one  
> would just automatically get used, but apparently not?

Oi. sorry. ignore that.

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 13, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/cant-get-simple-link-to-remote-to-work/134644/4 "2008-04-13T15:45:23Z")

</div>

Greg,

Glad to see you got this working! I used to encounter the same types  
of things… weird errors that turned out to be obscure syntactic  
mistakes (like a wrongly placed or missing } in your example).

In these cases, the API docs are indispensible… to know when you need  
a hash or a hash of hashes, or stuff like that.

-Danimal

On Apr 13, 2:52 am, Greg W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
