Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created April 16, 2009 03:59
Show Gist options
  • Select an option

  • Save practicingruby/96205 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/96205 to your computer and use it in GitHub Desktop.
class CustomersController < ApplicationController
def index
@customers = Customer.find(:all)
respond_to do |format|
format.xml { render :xml => @customers }
format.html
end
end
def show
customer = Customer.find(params[:id])
respond_to do |format|
format.xml { render :xml => customer.to_xml }
format.html
end
end
def create
customer = Customer.create(params[:customer])
respond_to do |format|
format.html { redirect_to entry }
format.xml { render :xml => customer, :status => :created, :location => customer }
end
end
def update
customer = Customer.update(params[:id], params[:customer])
respond_to do |format|
format.xml { render :xml => customer.to_xml }
format.html
end
end
def destroy
Customer.destroy(params[:id])
respond_to do |format|
format.xml { render :xml => "", :status => 200 }
format.html
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment