Sha256: 9a3a912005fc7691547ea84c6b909ead132acb079402193a322c3f1199463f7b
Contents?: true
Size: 1.94 KB
Versions: 9
Compression:
Stored size: 1.94 KB
Contents
require_dependency 'application_controller' module Logistics module Core class BroadGaugeCntsController < ApplicationController protect_from_forgery with: :null_session before_action :set_broad_gauge_cnt, only: [:update] # GET /broad_gauge_cnts # GET /broad_gauge_cnts.json def index broad_gauge_cnts = BroadGaugeCnt.fetch_all response = Mks::Common::MethodResponse.new(true, nil, broad_gauge_cnts, nil, nil) render json: response end # POST /broad_gauge_cnts # POST /broad_gauge_cnts.json def create broad_gauge_cnt = BroadGaugeCnt.new(broad_gauge_cnt_params) if broad_gauge_cnt.save response = Mks::Common::MethodResponse.new(true, "Containerized Broad Gauge information saved successfully!", broad_gauge_cnt, nil) else errors = Mks::Common::Util.error_messages broad_gauge_cnt, "Containerzed Broad Gauge" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end # PATCH/PUT /broad_gauge_cnts/1 # PATCH/PUT /broad_gauge_cnts/1.json def update broad_gauge_cnt = BroadGaugeCnt.find(params[:id]) if broad_gauge_cnt.update(broad_gauge_cnt_params) response = Mks::Common::MethodResponse.new(true, "Containerized Broad Gauge information updated successfully!", broad_gauge_cnt, nil) else errors = Mks::Common::Util.error_messages broad_gauge_cnt, "Containerzed Broad Gauge" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end private def set_broad_gauge_cnt @broad_gauge_cnt = BroadGaugeCnt.find(params[:id]) end def broad_gauge_cnt_params params.require(:broad_gauge_cnt).permit(:container_size_id, :container_type_id, :length, :width, :height, :actual_weight) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems