Class: Gamification::LevelsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/gamification/levels_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /levels



26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/gamification/levels_controller.rb', line 26

def create
  authorize! :create, @level

  @level = Level.new(level_params)

  if @level.save
    redirect_to @level, notice: 'Level was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /levels/1



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

def destroy
  @level.destroy
  redirect_to levels_url, notice: 'Level was successfully destroyed.'
end

#editObject

GET /levels/1/edit



22
23
# File 'app/controllers/gamification/levels_controller.rb', line 22

def edit
end

#indexObject

GET /levels



8
9
10
# File 'app/controllers/gamification/levels_controller.rb', line 8

def index
  @levels = Level.all
end

#newObject

GET /levels/new



17
18
19
# File 'app/controllers/gamification/levels_controller.rb', line 17

def new
  @level = Level.new
end

#showObject

GET /levels/1



13
14
# File 'app/controllers/gamification/levels_controller.rb', line 13

def show
end

#updateObject

PATCH/PUT /levels/1



39
40
41
42
43
44
45
# File 'app/controllers/gamification/levels_controller.rb', line 39

def update
  if @level.update(level_params)
    redirect_to @level, notice: 'Level was successfully updated.'
  else
    render :edit
  end
end