# Url\_for, form\_remote\_tag when rendered from an ajax referenc

**URL:** <https://www.ruby-forum.com/t/url-for-form-remote-tag-when-rendered-from-an-ajax-referenc/92392>\
**Category:** Rails\
**Created:** [April 18, 2007, 11:40pm UTC](https://www.ruby-forum.com/t/url-for-form-remote-tag-when-rendered-from-an-ajax-referenc/92392 "2007-04-18T23:40:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [April 18, 2007, 11:40pm UTC](https://www.ruby-forum.com/t/url-for-form-remote-tag-when-rendered-from-an-ajax-referenc/92392/1 "2007-04-18T23:40:10Z")

</div>

I’ve done this a hundred times in other places in my code but it seems  
that  
this has suddenly broken. I can replicate it on my coworkers  
computer…  
I’m generating a form\_remote\_tag from within a partial as so:

\<% form\_remote\_tag(:update =\> ‘acct\_balance’,  
:url =\> ‘/report/ajax\_get\_balance’,  
:html =\> {:name =\> ‘update\_balance’, :id =\>  
‘update\_balance’}) do -%\>  
  
\<% end -%\>

When rendering this non-ajax, it generates the URL for form\_remote\_tag  
correctly…

When Rendering this through an Ajax call in which case render :partial  
is  
called from same action, , I’m receiving:

undefined method `rewrite' for #<String:0x366c7a0> /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:522:in`url\_for’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_view/helpers/url\_helper.rb:27:in  
`url_for' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/url_helper.rb:75:in`link\_to’

in url\_for in base.rb, this is doing:

@url.rewrite

however in this case @url.rewrite is a string when it is nromally a  
UrlRewrite object so @url.rewrite fails…

Anyone have this problem? Running

lemming:/Users/sblackstone/development/rwjf root# rails -v  
Rails 1.2.3

Thanks!

Stephen
