def _layout_for_ajax(default) #:nodoc:
      ajax_layout = self.class.read_inheritable_attribute(:ajax_layout)
      ajax_layout = if ajax_layout.nil? && default.nil?
          nil
        elsif ajax_layout.nil? && !default.nil? # look for one with the default name in layouts/ajax
          if default =~ /^layouts\/ajax\//
            default
          elsif !(default =~ /^ajax\//)
            "ajax/#{default.sub(/layouts(\/)?/, '')}"
          else
            default
          end
        elsif ajax_layout.include?(?/) # path to specific layout
          ajax_layout
        else # layout name, look in ajax/
          "ajax/#{ajax_layout}"
        end
      ajax_layout = ajax_layout =~ /\blayouts/ ? ajax_layout : "layouts/#{ajax_layout}" if ajax_layout
      ajax_layout
    end
def _layout_for_ajax(default) #:nodoc:
      ajax_layout = self.class.read_inheritable_attribute(:ajax_layout)
      ajax_layout = if ajax_layout.nil? && default.nil?
          nil
        elsif ajax_layout.nil? && !default.nil? # look for one with the default name in layouts/ajax
          if default =~ /^layouts\/ajax\//
            default
          elsif !(default =~ /^ajax\//)
            "ajax/#{default.sub(/layouts(\/)?/, '')}"
          else
            default
          end
        elsif ajax_layout.include?(?/) # path to specific layout
          ajax_layout
        else # layout name, look in ajax/
          "ajax/#{ajax_layout}"
        end
      ajax_layout = ajax_layout =~ /\blayouts/ ? ajax_layout : "layouts/#{ajax_layout}" if ajax_layout
      ajax_layout
    end
Return the layout to use for an AJAX request, or nil if the default should be used.

 If no ajax_layout is set, look for the default layout in <tt>layouts/ajax</tt>.
 If the layout cannot be found, use the default.