We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

vanne on 12/23/06


Tagged

rails ruby


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

jessicag79


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.