Sha256: 9c1cb11efc0b4b9bce598b474fe4a9f8cbc8f80ba6e3173f621af75d978abbe2

Contents?: true

Size: 1.72 KB

Versions: 3

Compression:

Stored size: 1.72 KB

Contents

class Gamification::ItemGroupsController < ApplicationController
  before_action :set_gamification_item_group, only: [:show, :edit, :update, :destroy]
  before_action :authenticate_user!
  load_and_authorize_resource except: [:create]
  # GET /gamification/item_groups
  def index
    @gamification_item_groups = Gamification::ItemGroup.all
  end

  # GET /gamification/item_groups/1
  def show
  end

  # GET /gamification/item_groups/new
  def new
    @gamification_item_group = Gamification::ItemGroup.new
  end

  # GET /gamification/item_groups/1/edit
  def edit
  end

  # POST /gamification/item_groups
  def create
    authorize! :create, @gamification_item_group

    @gamification_item_group = Gamification::ItemGroup.new(gamification_item_group_params)

    if @gamification_item_group.save
      redirect_to @gamification_item_group, notice: 'Item group was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /gamification/item_groups/1
  def update
    if @gamification_item_group.update(gamification_item_group_params)
      redirect_to @gamification_item_group, notice: 'Item group was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /gamification/item_groups/1
  def destroy
    @gamification_item_group.destroy
    redirect_to gamification_item_groups_url, notice: 'Item group was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_gamification_item_group
      @gamification_item_group = Gamification::ItemGroup.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def gamification_item_group_params
      params.require(:gamification_item_group).permit(:name)
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
go_gamification-0.0.20 app/controllers/gamification/item_groups_controller.rb
go_gamification-0.0.19 app/controllers/gamification/item_groups_controller.rb
go_gamification-0.0.18 app/controllers/gamification/item_groups_controller.rb