Forum: Ruby on Rails AJAX: link_to_remote problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Willi W. (Guest)
on 2006-01-11 19:11
I use:
<%= link_to_remote("Update",
	           :update => 'mydiv',
		   :url => { :action => :create, :host => 'rails' }) %>

which generates the following:

<a href="#" onclick="new Ajax.Updater('mydiv', '/account/create',
{asynchronous:true, evalScripts:true}); return false;">Update</a>

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

Using the following:

<%= link_to_remote("Update 2",
		   :update => 'mydiv',
		   :url => '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

the controller contains:

  def create
    render :layout => false

create.rhtml contains:

<em>Hello from Ajax!</em>

new.rhtml contains:
<%= javascript_include_tag :defaults %>

<%= link_to_remote("Update",
	           :update => 'mydiv',
		   :url => { :action => :create, :host => 'rails' }) %>
<div id="mydiv"><p>This text will be changed 2</p></div>

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


This topic is locked and can not be replied to.