With RubyOnRails

  def add
    company = params[:person].delete(:company)
    @company = Company.find_or_create_by_name(company[:name])
    @person  = @company.people.create(params[:person])

    respond_to do |wants|
      wants.html { redirect_to(person_list_url) }
      wants.js
      wants.xml  { render :xml => @person.to_xml(:include => @company) }
    end
  end

With Camping

class Add
  def post
    company = input.person.delete(:company)
    @company = Company.find_or_create_by_name(company[:name])
    @person  = @company.people.create(input.person)

    case env.ACCEPT
    when /text\/html/, /*\/*/
      redirect R(PersonList)
    when /text\/javascript/
    when /application\/xml/
      @headers['Content-Type'] = 'application/xml; charset=utf8'
      @person.to_xml(:include => @company)
    end
  end
  alias_method :get, :post
end

Notes :