Sha256: 238b307630a9598caf206055da6cbbc766d8512de2358c3a159b39c6a676ef4d
Contents?: true
Size: 1.8 KB
Versions: 9
Compression:
Stored size: 1.8 KB
Contents
module Logistics module Core class BreakBulkUnitsController < ApplicationController before_action :set_break_bulk_unit, only: [:update] # GET /break_bulk_units # GET /break_bulk_units.json def index @break_bulk_units = BreakBulkUnit.all response = Mks::Common::MethodResponse.new(true,nil,@break_bulk_units,nil,nil) render json: response end # POST /break_bulk_units # POST /break_bulk_units.json def create @break_bulk_unit = BreakBulkUnit.new(break_bulk_unit_params) if @break_bulk_unit.valid? @break_bulk_unit.save @response = Mks::Common::MethodResponse.new(true,'Break bulk unit recorded successfully',nil,nil,nil) render json: @response else errors = Mks::Common::Util.error_messages @break_bulk_unit, 'Break Bulk Unit' @response = Mks::Common::MethodResponse.new(false,nil,nil,errors,nil) render json: @response end end # PATCH/PUT /break_bulk_units/1 # PATCH/PUT /break_bulk_units/1.json def update if @break_bulk_unit.update_attributes(break_bulk_unit_params) @break_bulk_unit.save @response = Mks::Common::MethodResponse.new(true,'Break bulk unit updated successfully',nil,nil,nil) render json: @response else errors = Mks::Common::Util.error_messages @break_bulk_unit, 'Break Bulk Unit' @response = Mks::Common::MethodResponse.new(false,nil,nil,errors,nil) render json: @response end end private def set_break_bulk_unit @break_bulk_unit = BreakBulkUnit.find(params[:id]) end def break_bulk_unit_params params.require(:break_bulk_unit).permit(:code, :name) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems