app/controllers/gamification/levels_controller.rb in go_gamification-0.0.17 vs app/controllers/gamification/levels_controller.rb in go_gamification-0.0.18
- old
+ new
@@ -1,10 +1,11 @@
module Gamification
class LevelsController < ApplicationController
+ before_action :authenticate_user!, except: [:list, :show_list]
+ before_action :authenticate_user!
+ load_and_authorize_resource except: [:create]
- before_action :set_level, only: [:show, :edit, :update, :destroy]
-
# GET /levels
def index
@levels = Level.all
end
@@ -21,9 +22,11 @@
def edit
end
# POST /levels
def create
+ authorize! :create, @level
+
@level = Level.new(level_params)
if @level.save
redirect_to @level, notice: 'Level was successfully created.'
else