Class: WorkAccountsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/work_accounts_controller.rb

Constant Summary

Constants included from Localization

Localization::LOCALIZED_STRINGS

Instance Method Summary collapse

Methods inherited from ApplicationController

in_place_edit_for, #initialize

Methods included from ApplicationHelper

#back_or_link_to, #detour?, #detour_to, #display_notice, #h, #image_button_to, #image_detour_to, #image_link_to, #image_link_to_remote, #insert, #record, #resolution_image, #t, #with_detour

Methods included from Localization

#l, load_localized_strings, #valid_language?

Constructor Details

This class inherits a constructor from ApplicationController

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/work_accounts_controller.rb', line 23

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

#destroyObject



47
48
49
50
# File 'app/controllers/work_accounts_controller.rb', line 47

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

#editObject



33
34
35
# File 'app/controllers/work_accounts_controller.rb', line 33

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

#indexObject



2
3
4
5
# File 'app/controllers/work_accounts_controller.rb', line 2

def index
  list
  render :action => 'list'
end

#listObject



11
12
13
# File 'app/controllers/work_accounts_controller.rb', line 11

def list
  @work_accounts = WorkAccount.paginate :page => params[:page]
end

#newObject



19
20
21
# File 'app/controllers/work_accounts_controller.rb', line 19

def new
  @work_account = WorkAccount.new
end

#showObject



15
16
17
# File 'app/controllers/work_accounts_controller.rb', line 15

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

#updateObject



37
38
39
40
41
42
43
44
45
# File 'app/controllers/work_accounts_controller.rb', line 37

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