Sha256: faae17decd52aa4c435da1848fed57777a44b66db2d3975be06b8a3869497e0f
Contents?: true
Size: 1.85 KB
Versions: 9
Compression:
Stored size: 1.85 KB
Contents
module Logistics module Core class ContainerSizesController < ApplicationController before_action :set_container_size, only: [:update] # GET /container_sizes # GET /container_sizes.json def index @container_sizes = ContainerSize.all @response = {:success => true, :message => '', :data => @container_sizes} render json: @response end # POST /container_sizes # POST /container_sizes.json def create @container_size = ContainerSize.new(container_size_params) if @container_size.save response = Mks::Common::MethodResponse.new(true, 'Container size recorded successfully', nil, nil, nil) render json: response else errors = Mks::Common::Util.error_messages @container_size, 'Container Size' response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) render json: response end end # PATCH/PUT /container_sizes/1 # PATCH/PUT /container_sizes/1.json def update if @container_size.update(container_size_params) response = Mks::Common::MethodResponse.new(true, 'Container size updated successfully', nil, nil, nil) render json: response else errors = Mks::Common::Util.error_messages @container_size, 'Container Size' 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_size @container_size = ContainerSize.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def container_size_params params.require(:container_size).permit(:code, :name) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems