Class: CapacitiesController

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

Instance Method Summary collapse

Methods included from ApplicationHelper

#footer_menu, #home_page, #page_title

Instance Method Details

#createObject



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

def create
  @capacity = Capacity.new(params[:capacity])
  @capacity.iteration= ProjectInfo.find(:first).current_iteration
  if @capacity.save
    flash[:notice] = 'Capacity was successfully created.'
    redirect_to :action => 'list'
  else
    render :action => 'new'
  end
end

#destroyObject



48
49
50
51
# File 'app/controllers/capacities_controller.rb', line 48

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

#editObject



34
35
36
# File 'app/controllers/capacities_controller.rb', line 34

def edit
  @capacity = Capacity.find(params[:id])
end

#indexObject



6
7
8
9
# File 'app/controllers/capacities_controller.rb', line 6

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

#listObject



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

def list
  @capacity_pages, @capacities = paginate :capacities, :conditions => 'capacities.iteration = ' + ProjectInfo.find(1).current_iteration.to_s, :per_page => 10
end

#newObject



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

def new
  @capacity = Capacity.new
end

#showObject



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

def show
  @capacity = Capacity.find(params[:id])
end

#updateObject



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

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