Class: Rankit::RankablesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_out_path_for

Instance Method Details

#createObject



16
17
18
19
20
21
22
# File 'app/controllers/rankit/rankables_controller.rb', line 16

def create
  @rankable = Rankable.new(rankable_params)
  @rankable.creator = current_user
  if @rankable.save
    redirect_to(rankit.rankables_path)
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/rankit/rankables_controller.rb', line 34

def destroy
  @rankable.destroy
  redirect_to rankit.rankables_path, :notice => 'Rankable was deleted succesfully'
end

#editObject



24
25
# File 'app/controllers/rankit/rankables_controller.rb', line 24

def edit
end

#indexObject



8
9
10
# File 'app/controllers/rankit/rankables_controller.rb', line 8

def index
  @rankables = Rankable.all
end

#newObject



12
13
14
# File 'app/controllers/rankit/rankables_controller.rb', line 12

def new
  @rankable = Rankable.new
end

#updateObject



27
28
29
30
31
32
# File 'app/controllers/rankit/rankables_controller.rb', line 27

def update
  @rankable.update_attributes rankable_params
  if @rankable.save
    redirect_to rankit.rankables_path, :notice => 'Rankable was updated succesfully'
  end
end