Sha256: 995532e4d3b3f337d30c24c4d364fa23ed4a380ae4e501c10c9a655e59537440
Contents?: true
Size: 1.42 KB
Versions: 9
Compression:
Stored size: 1.42 KB
Contents
module Logistics module Core class ChargeableServiceIncrementsController < ApplicationController # GET /chargeable_service_increments # GET /chargeable_service_increments.json def index @chargeable_service_increments = ChargeableServiceIncrement.all @response = {:success => true, :message => '', :data => @chargeable_service_increments} render json: @response end # POST /chargeable_service_increments # POST /chargeable_service_increments.json def create uoc_list = params[:increments] cs_uoc = nil if uoc_list.count > 0 cs_uoc = ChargeableServiceUnitOfCharge.find(uoc_list[0][:chargeable_service_unit_of_charge_id]) end uoc_list.each do |uoc| increment = ServiceIncrement.find(uoc[:service_increment_id]) cs_uoc.service_increments << increment end begin cs_uoc.save response = {:success => true, :message => 'Service Increment successfully'} rescue => e response = {:success => false, :message => e.message} end render json: response end private # Never trust parameters from the scary internet, only allow the white list through. def chargeable_service_increment_params params.permit(:increments => [:chargeable_service_unit_of_charge_id, :service_increment_id]) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems