Sha256: 7621dba4722efe60a75d217caf9da882013829d489805e07538e164e6095051a

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

class Gamification::ItemsController < ApplicationController
  before_action :set_gamification_item, only: [:show, :edit, :update, :destroy]

  # GET /gamification/items
  def index
    @gamification_items = Gamification::Item.all
  end

  # GET /gamification/items/1
  def show
  end

  # GET /gamification/items/new
  def new
    @gamification_item = Gamification::Item.new
  end

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

  # POST /gamification/items
  def create
    @gamification_item = Gamification::Item.new(gamification_item_params)

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

  # PATCH/PUT /gamification/items/1
  def update
    if @gamification_item.update(gamification_item_params)
      redirect_to @gamification_item, notice: 'Item was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /gamification/items/1
  def destroy
    @gamification_item.destroy
    redirect_to gamification_items_url, notice: 'Item was successfully destroyed.'
  end

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

    # Only allow a trusted parameter "white list" through.
    def gamification_item_params
      params.require(:gamification_item).permit(:name, :gamification_item_type_id,:gamification_item_group_id, :image, :rarity, :cost,:user_id, :description)
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
go_gamification-0.0.17 app/controllers/gamification/items_controller.rb