Class: PrioritiesController

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

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

#destroyObject



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

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

#editObject



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

def edit
  @priority = Priority.find(params[:id])
end

#indexObject



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

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

#listObject



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

def list
  @priority_pages, @priorities = paginate :priorities, :per_page => 10
end

#newObject



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

def new
  @priority = Priority.new
end

#showObject



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

def show
  @priority = Priority.find(params[:id])
end

#updateObject



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

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