Created
April 16, 2009 03:59
-
-
Save practicingruby/96205 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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