Sha256: f8f1481052598deb751e96fe4aa6c92dd4a5cc1a78b64ec605b8266475df504e

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

class WorkAccountsController < 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
    @work_accounts = WorkAccount.paginate :page => params[:page]
  end

  def show
    @work_account = WorkAccount.find(params[:id])
  end

  def new
    @work_account = WorkAccount.new
  end

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

  def edit
    @work_account = WorkAccount.find(params[:id])
  end

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
backlog-0.17.0 app/controllers/work_accounts_controller.rb
backlog-0.17.1 app/controllers/work_accounts_controller.rb
backlog-0.17.2 app/controllers/work_accounts_controller.rb
backlog-0.17.3 app/controllers/work_accounts_controller.rb
backlog-0.17.4 app/controllers/work_accounts_controller.rb
backlog-0.17.5 app/controllers/work_accounts_controller.rb