Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AdminsController < ApplicationController
- # GET /admins
- # GET /admins.xml
- def index
- @admins = Customer.all
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @admins }
- end
- end
- # GET /admins/1
- # GET /admins/1.xml
- def show
- @admin = Customer.find(params[:id])
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @admin }
- end
- end
- # GET /admins/new
- # GET /admins/new.xml
- def new
- @admin = Customer.new
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @admin }
- end
- end
- # GET /admins/1/edit
- def edit
- @admin = Customer.find(params[:id])
- end
- # POST /admins
- # POST /admins.xml
- def create
- @admin = Customer.new(params[:admin])
- respond_to do |format|
- if @admin.save
- flash[:notice] = 'Admin was successfully created.'
- format.html { redirect_to(@admin) }
- format.xml { render :xml => @admin, :status => :created, :location => @admin }
- else
- format.html { render :action => "new" }
- format.xml { render :xml => @admin.errors, :status => :unprocessable_entity }
- end
- end
- end
- # PUT /admins/1
- # PUT /admins/1.xml
- def update
- @admin = Customer.find(params[:id])
- respond_to do |format|
- if @admin.update_attributes(params[:admin])
- flash[:notice] = 'Admin was successfully updated.'
- format.html { redirect_to(@admin) }
- format.xml { head :ok }
- else
- format.html { render :action => "edit" }
- format.xml { render :xml => @admin.errors, :status => :unprocessable_entity }
- end
- end
- end
- # DELETE /admins/1
- # DELETE /admins/1.xml
- def destroy
- @admin = Customer.find(params[:id])
- @admin.destroy
- respond_to do |format|
- format.html { redirect_to(admins_url) }
- format.xml { head :ok }
- end
- end
- end
Add Comment
Please, Sign In to add comment