Sha256: 1f4d47b01945a9445b79f2017d99f4633db2c2254cd008542b8fc72b08bf2f7f
Contents?: true
Size: 1.22 KB
Versions: 15
Compression:
Stored size: 1.22 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_account_pages, @work_accounts = paginate :work_accounts, :per_page => 10 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
15 entries across 15 versions & 1 rubygems