# AJAX: link\_to\_remote problem

**URL:** <https://www.ruby-forum.com/t/ajax-link-to-remote-problem/52175>\
**Category:** Rails\
**Created:** [January 11, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/ajax-link-to-remote-problem/52175 "2006-01-11T18:11:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![williw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@williw](https://www.ruby-forum.com/u/williw)\
**Post date:** [January 11, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/ajax-link-to-remote-problem/52175/1 "2006-01-11T18:11:46Z")

</div>

I use:  
\<%= link\_to\_remote(“Update”,  
:update =\> ‘mydiv’,  
:url =\> { :action =\> :create, :host =\> ‘rails’ }) %\>

which generates the following:

Update

as a result /account/create is routed to http:/localhost//account/create  
(which runs mod Python) and  
not as I would like (and need) to [http://rails/account/create](http://rails/account/create)

Using the following:

\<%= link\_to\_remote(“Update 2”,  
:update =\> ‘mydiv’,  
:url =\> ‘[http://rails/account/create](http://rails/account/create)’ ) %\>

doesn’t work either. It results in using the correct url, but the url  
parameter seems to be not correct:

TypeError in Account#create  
can’t dup NilClass  
RAILS\_ROOT: C:/Projects/Athena/rails/public/…/config/…

Application Trace | Framework Trace | Full Trace  
#{RAILS\_ROOT}/vendor/plugins/javascript\_generator\_templates/lib/add\_rjs\_to\_action\_controller.rb:41:in  
`dup’

the controller contains:

def create  
render :layout =\> false  
end

create.rhtml contains:

_Hello from Ajax!_

new.rhtml contains:  
\<%= javascript\_include\_tag :defaults %\>

\<%= link\_to\_remote(“Update”,  
:update =\> ‘mydiv’,  
:url =\> { :action =\> :create, :host =\> ‘rails’ }) %\>

This text will be changed 2

Does anybody have any idea on how to work around this problem?

Thanks,

Willi
