Class: Logistics::Core::FreightTonStorageRatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::FreightTonStorageRatesController
- Defined in:
- app/controllers/logistics/core/freight_ton_storage_rates_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/logistics/core/freight_ton_storage_rates_controller.rb', line 19 def create FreightTonStorageRate.generate_storage_rate params[:rate_period_id], params[:effective_date] response = Mks::Common::MethodResponse.new(true, 'Freight ton storage rate matrix generated successfully !', nil, nil, nil) render json: response end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/logistics/core/freight_ton_storage_rates_controller.rb', line 4 def index rate_period_id = params[:rate_period_id] @freight_ton_storage_rates = FreightTonStorageRate.where('warehouse_rate_period_id' => rate_period_id) freight_ton_storage_rate_array =[] @freight_ton_storage_rates.each { |fsr| freight_ton_storage_rate_array.push({:id => fsr.id, :transaction_name => fsr.transaction_type.name, :content_type_name => fsr.content_type.name, :rate => fsr.rate, :effective_date => fsr.effective_date }) } @response = Mks::Common::MethodResponse.new(true, nil, freight_ton_storage_rate_array, nil, nil) render json: @response end |
#update ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/logistics/core/freight_ton_storage_rates_controller.rb', line 25 def update freight_ton_storage_rates = params[:freight_ton_storage_rates] freight_ton_storage_rates.each { |fsr| old_freight_ton_storage_rate = FreightTonStorageRate.find(fsr['id']) old_freight_ton_storage_rate.rate = fsr['rate'] old_freight_ton_storage_rate.effective_date = fsr['effective_date'] old_freight_ton_storage_rate.save } @response = Mks::Common::MethodResponse.new(true, 'Freight ton storage rate(s) updated successfully !', nil, nil, nil) render json: @response end |