inventory setup
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
class InventoryDefinitionsController < ApplicationController
|
||||
before_action :set_inventory_definition, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /inventory_definitions
|
||||
# GET /inventory_definitions.json
|
||||
def index
|
||||
@inventory_definitions = InventoryDefinition.all
|
||||
end
|
||||
|
||||
# GET /inventory_definitions/1
|
||||
# GET /inventory_definitions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /inventory_definitions/new
|
||||
def new
|
||||
@inventory_definition = InventoryDefinition.new
|
||||
end
|
||||
|
||||
# GET /inventory_definitions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /inventory_definitions
|
||||
# POST /inventory_definitions.json
|
||||
def create
|
||||
@inventory_definition = InventoryDefinition.new(inventory_definition_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @inventory_definition.save
|
||||
format.html { redirect_to @inventory_definition, notice: 'Inventory definition was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @inventory_definition }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @inventory_definition.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /inventory_definitions/1
|
||||
# PATCH/PUT /inventory_definitions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @inventory_definition.update(inventory_definition_params)
|
||||
format.html { redirect_to @inventory_definition, notice: 'Inventory definition was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @inventory_definition }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @inventory_definition.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /inventory_definitions/1
|
||||
# DELETE /inventory_definitions/1.json
|
||||
def destroy
|
||||
@inventory_definition.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to inventory_definitions_url, notice: 'Inventory definition was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_inventory_definition
|
||||
@inventory_definition = InventoryDefinition.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def inventory_definition_params
|
||||
params.fetch(:inventory_definition, {})
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user