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.37.2 app/controllers/customers_controller.rb
backlog-0.37.1 app/controllers/customers_controller.rb
backlog-0.36.2 app/controllers/customers_controller.rb
backlog-0.17.0 app/controllers/customers_controller.rb
backlog-0.17.1 app/controllers/customers_controller.rb
backlog-0.17.2 app/controllers/customers_controller.rb
backlog-0.17.3 app/controllers/customers_controller.rb
backlog-0.17.4 app/controllers/customers_controller.rb
backlog-0.17.5 app/controllers/customers_controller.rb
backlog-0.18.0 app/controllers/customers_controller.rb
backlog-0.17.6 app/controllers/customers_controller.rb
backlog-0.19.0 app/controllers/customers_controller.rb
backlog-0.20.0 app/controllers/customers_controller.rb
backlog-0.20.1 app/controllers/customers_controller.rb
backlog-0.21.0 app/controllers/customers_controller.rb
backlog-0.21.1 app/controllers/customers_controller.rb
backlog-0.21.2 app/controllers/customers_controller.rb
backlog-0.21.3 app/controllers/customers_controller.rb
backlog-0.22.0 app/controllers/customers_controller.rb
backlog-0.22.1 app/controllers/customers_controller.rb