Permalink
Browse files

adding xml responder

  • Loading branch information...
1 parent a2e03ed commit abceacee717ce187f9e602f5167298d9aaea33e6 @larsburgess larsburgess committed Oct 22, 2012
Showing with 15 additions and 0 deletions.
  1. +8 −0 app/controllers/customers_controller.rb
  2. +7 −0 app/controllers/products_controller.rb
@@ -7,6 +7,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.json { render json: @customers }
+ format.xml { render xml: @customers }
end
end
@@ -18,6 +19,7 @@ def show
respond_to do |format|
format.html # show.html.erb
format.json { render json: @customer }
+ format.xml { render xml: @customer }
end
end
@@ -29,6 +31,7 @@ def new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @customer }
+ format.xml { render xml: @customer }
end
end
@@ -46,9 +49,11 @@ def create
if @customer.save
format.html { redirect_to @customer, notice: 'Customer was successfully created.' }
format.json { render json: @customer, status: :created, location: @customer }
+ format.xml { render xml: @customer, status: :created, location: @customer }
else
format.html { render action: "new" }
format.json { render json: @customer.errors, status: :unprocessable_entity }
+ format.xml { render xml: @customer.errors, status: :unprocessable_entity }
end
end
end
@@ -62,9 +67,11 @@ def update
if @customer.update_attributes(params[:customer])
format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }
format.json { head :no_content }
+ format.xml { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @customer.errors, status: :unprocessable_entity }
+ format.json { render xml: @customer.errors, status: :unprocessable_entity }
end
end
end
@@ -78,6 +85,7 @@ def destroy
respond_to do |format|
format.html { redirect_to customers_url }
format.json { head :no_content }
+ format.xml { head :no_content }
end
end
end
@@ -12,6 +12,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @products }
+ format.xml { render :xml => @products }
end
end
@@ -23,6 +24,7 @@ def show
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @product }
+ format.xml { render :xml => @product }
end
end
@@ -34,6 +36,7 @@ def new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @product }
+ format.xml { render :xml => @product }
end
end
@@ -55,6 +58,7 @@ def create
format.json { render :json => @product, :status => :created, :location => @product }
else
format.html { render :action => "new" }
+ format.json { render :json => @product.errors, :status => :unprocessable_entity }
format.xml { render :xml => @product.errors, :status => :unprocessable_entity }
end
end
@@ -70,9 +74,11 @@ def update
flash[:notice] = 'Product was successfully updated.'
format.html { redirect_to(@product) }
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @product.errors, :status => :unprocessable_entity }
+ format.json { render :json => @product.errors, :status => :unprocessable_entity }
end
end
end
@@ -86,6 +92,7 @@ def destroy
respond_to do |format|
format.html { redirect_to(products_url) }
format.xml { head :ok }
+ format.json { head :ok }
end
end

0 comments on commit abceace

Please sign in to comment.