Class: CapacitiesController
Instance Method Summary
collapse
#footer_menu, #home_page, #page_title
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
48
49
50
51
|
# File 'app/controllers/capacities_controller.rb', line 48
def destroy
Capacity.find(params[:id]).destroy
redirect_to :action => 'list'
end
|
#edit ⇒ Object
34
35
36
|
# File 'app/controllers/capacities_controller.rb', line 34
def edit
@capacity = Capacity.find(params[:id])
end
|
#index ⇒ Object
6
7
8
9
|
# File 'app/controllers/capacities_controller.rb', line 6
def index
list
render :action => 'list'
end
|
#list ⇒ Object
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
|
#new ⇒ Object
19
20
21
|
# File 'app/controllers/capacities_controller.rb', line 19
def new
@capacity = Capacity.new
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/capacities_controller.rb', line 15
def show
@capacity = Capacity.find(params[:id])
end
|
#update ⇒ Object
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
|