Class: Logistics::Core::CarrierTypesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::CarrierTypesController
- Defined in:
- app/controllers/logistics/core/carrier_types_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/carrier_types_controller.rb', line 16 def create @carrier_type = CarrierType.new(carrier_type_params) if @carrier_type.valid? @carrier_type.save @response = Mks::Common::MethodResponse.new(true, 'Carrier type saved successfully !',nil,nil,nil); render json: @response else errors = Mks::Common::Util. @carrier_type, 'CarrierType' @response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) render json: @response end end |
#index ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/logistics/core/carrier_types_controller.rb', line 6 def index @carrier_types = CarrierType.all carrier_type_array =[] @carrier_types.each { |ct| carrier_type_array.push({:id => ct.id, :code => ct.code, :name => ct.name, :description => ct.description }) } @response = Mks::Common::MethodResponse.new(true, nil, carrier_type_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/carrier_types_controller.rb', line 29 def update if @carrier_type.update_attributes(carrier_type_params) @carrier_type.save @response = Mks::Common::MethodResponse.new(true, 'Carrier type updated successfully !', nil, nil, nil) render json: @response else errors = Mks::Common::Util. @carrier_type, 'CarrierType' @response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) render json: @response end end |