def serialize_ajax_info
      layout_name =
        if Ajax.app.rails?(3)
          if @_rendered_layout.is_a?(String)
            @_rendered_layout =~ /.*\/([^\/]*)/ ? $1 : @_rendered_layout
          elsif @_rendered_layout
            @_rendered_layout.variable_name
          end
        else
          active_layout
        end
      Ajax.set_header(response, :layout, layout_name)
      Ajax.set_header(response, :controller, self.class.controller_name)
    end
def serialize_ajax_info
      layout_name =
        if Ajax.app.rails?(3)
          if @_rendered_layout.is_a?(String)
            @_rendered_layout =~ /.*\/([^\/]*)/ ? $1 : @_rendered_layout
          elsif @_rendered_layout
            @_rendered_layout.variable_name
          end
        else
          active_layout
        end
      Ajax.set_header(response, :layout, layout_name)
      Ajax.set_header(response, :controller, self.class.controller_name)
    end
Convert the Ajax-Info hash to JSON before the request is sent.
 Invoked as an after filter.

 Adds the current +layout+ and +controller+ to the hash.
 These values will be sent in future requests using the Ajax-Info header.

 +controller+ is the result of calling ActionController#controller_name, so
 if your controller is ApplicationController the value will be <tt>'application'</tt>.

 +layout+ is the name of the layout without any path or extension.  So for example if
 layouts/simple.html.erb or layouts/ajax/simple.html.erb are rendered the
 value of +layout+ would be <tt>'simple'</tt> in both cases.