Sha256: b64a20ff03668f4e3357d7ed5e51afb017ea9e6bdb7478348bf118ca0e982c73

Contents?: true

Size: 1.13 KB

Versions: 42

Compression:

Stored size: 1.13 KB

Contents

class CustomersController < ApplicationController
  def index
    list
    render :action => 'list'
  end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }

  def list
    @customers = Customer.paginate :page => params[:page]
  end

  def show
    @customer = Customer.find(params[:id])
  end

  def new
    @customer = Customer.new
  end

  def create
    @customer = Customer.new(params[:customer])
    if @customer.save
      flash[:notice] = 'Customer was successfully created.'
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @customer = Customer.find(params[:id])
  end

  def update
    @customer = Customer.find(params[:id])
    if @customer.update_attributes(params[:customer])
      flash[:notice] = 'Customer was successfully updated.'
      redirect_to :action => 'show', :id => @customer
    else
      render :action => 'edit'
    end
  end

  def destroy
    Customer.find(params[:id]).destroy
    redirect_to :action => 'list'
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
backlog-0.23.0 app/controllers/customers_controller.rb
backlog-0.23.1 app/controllers/customers_controller.rb
backlog-0.24.0 app/controllers/customers_controller.rb
backlog-0.25.0 app/controllers/customers_controller.rb
backlog-0.26.0 app/controllers/customers_controller.rb
backlog-0.28.0 app/controllers/customers_controller.rb
backlog-0.29.0 app/controllers/customers_controller.rb
backlog-0.31.0 app/controllers/customers_controller.rb
backlog-0.30.0 app/controllers/customers_controller.rb
backlog-0.31.1 app/controllers/customers_controller.rb
backlog-0.32.0 app/controllers/customers_controller.rb
backlog-0.33.0 app/controllers/customers_controller.rb
backlog-0.34.1 app/controllers/customers_controller.rb
backlog-0.33.1 app/controllers/customers_controller.rb
backlog-0.34.2 app/controllers/customers_controller.rb
backlog-0.35.0 app/controllers/customers_controller.rb
backlog-0.34 app/controllers/customers_controller.rb
backlog-0.35.2 app/controllers/customers_controller.rb
backlog-0.35.1 app/controllers/customers_controller.rb
backlog-0.35.4 app/controllers/customers_controller.rb