# File lib/merb-core/controller/mixins/render.rb, line 179
  def display(object, thing = nil, opts = {})
    # display @object, "path/to/foo" means display @object, nil, :template => "path/to/foo"
    # display @object, :template => "path/to/foo" means display @object, nil, :template => "path/to/foo"
    template_opt = opts.delete(:template)
    
    case thing
    when String
      template_opt, thing = thing, nil
    when Hash
      opts, thing = thing, nil
    end
    
    # Try to render without the object
    render(thing || action_name.to_sym, opts.merge(:template => template_opt))
  
  # If the render fails (i.e. a template was not found)
  rescue TemplateNotFound
    # Merge with class level default render options
    opts = self.class.default_render_options.merge(opts)
    
    # Figure out what to transform and raise NotAcceptable unless there's a transform method assigned
    transform = Merb.mime_transform_method(content_type)
    raise NotAcceptable unless transform && object.respond_to?(transform)

    # Only use a layout if one was specified
    layout_opt = opts.delete(:layout)
    
    if layout_opt
      # Look for the layout under the default layout directly. If it's not found, reraise
      # the TemplateNotFound error
      template = _template_location(layout_opt, layout.index(".") ? content_type : nil, "layout")      
      layout = _template_for(_template_root / template) ||
        (raise TemplateNotFound, "No layout found at #{_template_root / template}.*")      
              
      # If the layout was found, call it
      send(layout)
    
    # Otherwise, just render the transformed object
    else
      unless opts.empty?
        # there are options for serialization method
        throw_content(:for_layout, object.send(transform, opts))
      else
        throw_content(:for_layout, object.send(transform))
      end  
      catch_content(:for_layout)
    end
  end