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

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

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]

latest version of mongrel.

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

Try render :partial => “login”

render :template assumes a full page redraw.


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.


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


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