Forum: Ruby on Rails js request / rendering issues

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris O. (Guest)
on 2009-01-11 05:39
Two issues:
1. Why does rails have a hard time detecting js calls?  If I make a
jquery ajax request to foo/bar it fails, but if I append a js extension
it passes => foo/bar.js. It seems that ror ignores the request headers
and only looks at the extension.  Am I missing something?

2. I am adding some ajax calls for some destroy requests and noticed
that rails always wants to render back the destroy.html.xxx template.
Obviously on a destroy ajax call I don't want a template rendered.

The only way to get around this is to do:

respond_to do |r|
  r.js { render :text => "", :template => false }
end

Is there something that I am missing that is causing this?

I am currently using v2.1.0, although it is on the todo list to update
the site after the current upgrades.

Thanks for the help.
This topic is locked and can not be replied to.