Class: Gamification::InventoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Gamification::InventoriesController
- Defined in:
- app/controllers/gamification/inventories_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /gamification/inventories.
-
#destroy ⇒ Object
DELETE /gamification/inventories/1.
-
#edit ⇒ Object
GET /gamification/inventories/1/edit.
-
#index ⇒ Object
GET /gamification/inventories.
-
#new ⇒ Object
GET /gamification/inventories/new.
-
#show ⇒ Object
GET /gamification/inventories/1.
-
#update ⇒ Object
PATCH/PUT /gamification/inventories/1.
Instance Method Details
#create ⇒ Object
POST /gamification/inventories
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/gamification/inventories_controller.rb', line 26 def create :create, @gamification_inventory @gamification_inventory = Gamification::Inventory.new(inventory_params) if @gamification_inventory.save redirect_to @gamification_inventory, notice: 'Inventory was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /gamification/inventories/1
53 54 55 56 |
# File 'app/controllers/gamification/inventories_controller.rb', line 53 def destroy @gamification_inventory.destroy redirect_to gamification_inventories_url, notice: 'Inventory was successfully destroyed.' end |
#edit ⇒ Object
GET /gamification/inventories/1/edit
22 23 |
# File 'app/controllers/gamification/inventories_controller.rb', line 22 def edit end |
#index ⇒ Object
GET /gamification/inventories
8 9 10 |
# File 'app/controllers/gamification/inventories_controller.rb', line 8 def index @gamification_inventories = Gamification::Inventory.all end |
#new ⇒ Object
GET /gamification/inventories/new
17 18 19 |
# File 'app/controllers/gamification/inventories_controller.rb', line 17 def new @gamification_inventory = Gamification::Inventory.new end |
#show ⇒ Object
GET /gamification/inventories/1
13 14 |
# File 'app/controllers/gamification/inventories_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /gamification/inventories/1
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/gamification/inventories_controller.rb', line 39 def update respond_to do |format| if @gamification_inventory.equip_item(params[:user_id].to_i) format.js format.json { head :no_content } else format.js format.json { render json: @gamification_inventory.errors, status: :unprocessable_entity } end end end |