Rails check for a .js template instead of .rjs?

respond_to do |format|
format.html
format.js { render :template => “login” }
end

Whenever I send an AJAX request to the action that has that code it says
it cant find the template login.js. Why isnt it looking for login.rjs?
Also when I take out the render it serves up the rhtml template instead
of the rjs template. Any idea why this is? I am using edge rails and the
latest version of mongrel.

On Jan 6, 2008 8:09 PM, Ben J. [email protected]
wrote:

latest version of mongrel.

Posted via http://www.ruby-forum.com/.

Try render :partial => “login”

render :template assumes a full page redraw.

Jason

An AJAX request is NOT a javascript request, it’s a HTML request. You’ll
need to request the js by suffixing it with .js.

http://url/login.js

Actually Ryan, AJAX is a javascript request (Async Javascript And XML).
I
use format.js quite extensively in one of my projects to differentiate
from
local AJAX and external XML requests.

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs