Returning from Ajax call - "redirect_to error"


#1

I have Ajax commenting on my site, well, I’m trying to get it working.
It worked fine locally, but when I posted to the server, I’m getting an
“Application Error (Rails)”, and I checked the logs, and it has:

(stack trace too deep)
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:447:in
url_for' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:769:inredirect_to’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:769:in
redirect_to' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:769:inredirect_to’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:769:in
`redirect_to’

With the second line continuing forever. Here’s my controller:

#controller
def comments
content = Content.find(params[:id])
@comment = Comment.new(params[:comment])
content.comments << @comment
content.save
@comment.save
@comment_count = Comment.count(“content_id=#{params[:id]}”)
render_without_layout
end

#remote form
<%= form_remote_tag(
:url => {:controller => ‘inventory’, :action => ‘comments’,
:id => content.id},
:update => {:success => “new-comment”},
:loading => “Element.show(‘loading’);”,
:success => “Element.hide(‘loading’);”,
:complete => “clearText();”,
:position => “bottom”
) %>

 <p>Name:<br/>
 <%= text_field "comment", "name", :size => "20" %></p>

 <p>Site:<br/>
 <%= text_field "comment", "site", :size => "20" %></p>

 <p>Remark:<br/>
 <%= text_area "comment", "entry", :rows => "7", :cols => "35"%></p>

 <p><input type="submit" name="submit" id="form-submit-button" 

value=“Post Remark” class=“btn” />

 <div class="cmnt-rss"><a href="/new/commentsfeed/" title="Syndicate 

Comments (RSS 2.0)">RSS 
2.0

<%= end_form_tag %>

Can someone please help with this? Why is ‘url_for’ used? What does it
do, and should I be using it?

Please help! This is running live, and I can’t fix it!

Thanks for any advice.