Class: Logistics::Core::SpecialIncrementContainerRatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::SpecialIncrementContainerRatesController
- Defined in:
- app/controllers/logistics/core/special_increment_container_rates_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/logistics/core/special_increment_container_rates_controller.rb', line 16 def create errors = [] container_increment = SpecialIncrementContainerRate.new(container_increment_params) if container_increment.valid? container_increment.save response = Mks::Common::MethodResponse.new(true, 'Container increment successfully created',nil,nil,nil) else errors << Mks::Common::Util.(container_increment, 'ContainerIncrement') response = Mks::Common::MethodResponse.new(false,nil,nil,errors,nil) end render json: response end |
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/logistics/core/special_increment_container_rates_controller.rb', line 5 def index container_increments = SpecialIncrementContainerRate.all container_increments_array = [] container_increments.each { |ci| container_increments_array.push({:id => ci.id, :container_type_id => ci.container_type_id, :container_type_name => ci.container_type.name, :rate => ci.rate, :effective_date => ci.effective_date}) } response = Mks::Common::MethodResponse.new(true,nil,container_increments_array,nil,nil) render json: response end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/logistics/core/special_increment_container_rates_controller.rb', line 29 def update @container_increment.update_attributes(container_increment_params) if @container_increment.save response = Mks::Common::MethodResponse.new(true, 'Container increment updated successfully !',nil,nil,nil) render json: response else errors = Mks::Common::Util. @container_increment, 'ContainerIncrement' @response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) render json: @response end end |