Sha256: 54b65bf3883f07bdae641bded843229f3697a7b16f1b0e433e21a2e9c78073e8
Contents?: true
Size: 1.89 KB
Versions: 9
Compression:
Stored size: 1.89 KB
Contents
module Logistics module Core class ContainerTypesController < ApplicationController before_action :set_container_type, only: [:show, :edit, :update, :destroy] # GET /container_types # GET /container_types.json def index @container_types = ContainerType.all @response = {:success => true, :message => '', :data => @container_types} render json: @response end # POST /container_types # POST /container_types.json def create @container_type = ContainerType.new(container_type_params) if @container_type.save response = Mks::Common::MethodResponse.new(true, 'Container type recorded successfully', nil, nil, nil) render json: response else errors = Mks::Common::Util.error_messages @container_type, 'Container Type' response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) render json: response end end # PATCH/PUT /container_types/1 # PATCH/PUT /container_types/1.json def update if @container_type.update(container_type_params) response = Mks::Common::MethodResponse.new(true, 'Container type updated successfully', nil, nil, nil) render json: response else errors = Mks::Common::Util.error_messages @container_type, 'Container Type' response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) render json: response end end private # Use callbacks to share common setup or constraints between actions. def set_container_type @container_type = ContainerType.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def container_type_params params.require(:container_type).permit(:code, :name, :is_standard) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems