Class: MilestonesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/milestones_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
# File 'app/controllers/milestones_controller.rb', line 23

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

#destroyObject



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

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

#editObject



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

def edit
  @milestone = Milestone.find(params[:id])
end

#indexObject



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

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

#listObject



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

def list
  @milestone_pages, @milestones = paginate :milestones, :per_page => 10
end

#newObject



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

def new
  @milestone = Milestone.new
end

#showObject



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

def show
  @milestone = Milestone.find(params[:id])
end

#updateObject



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

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