To call "render: layout => false" to correctly display the js.erb template in Rails 2.3.3
I am running the last branch of Rails 2-3-stable (currently 2.3.3).
I am using jQuery to send an AJAX request to my "create" action, in which I have the following block:
respond_to do |format|
format.js
end
I created create.js.erband to verify this action I added the following line:
alert('hello');
The request correctly enters the format.js block, but the answer tries to display the layout. Here is my log:
Jul 22 20:44:27 [2970] INFO: Rendering template within layouts/application
Jul 22 20:44:27 [2970] INFO: Rendering contacts/create
If I change my block respond_toto the following, it will work:
respond_to do |format|
format.js { render :layout => false }
end
Is this the expected behavior or is it a bug in Rails? I would think that the fact that I am executing a JS response would be enough to set the layout to false.