Posted By

vanne on 12/23/06


Tagged

rails ruby


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

jessicag79
umang_nine
webstic


Turn off Rails Layouts for AJAX Requests


 / Published in: Ruby
 

URL: http://artofmission.com/articles/2006/12/20/turn-off-rails-layouts-for-ajax-requests

This allows you to turn off ajax requests application wide, so that you don't have to do render :layout => false in every controller that needs it.

  1. layout proc{ |c| c.request.xhr? ? false : "application" }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: vanne on May 6, 2008

This doesn't seem to work in rails 2.0 anymore , this is the updated version:

layout proc{ |c| c.params[:format] == "js" ? false : "blank_page" }

You need to login to post a comment.