Notes posted by kallahk

RSS feed
March 28, 2012
1 thank

Disable layout on ajax

In actions that may or may not be loaded via ajax I use:

render :layout => !request.xhr?

For an entire controller I might use something like:

layout :has_layout?

  def has_layout?
    request.xhr? ? false : controller_name

What seems unusual is that

layout true

will try look for the layout true.erb