Class: Logistics::Core::DeclarantsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::DeclarantsController
- Defined in:
- app/controllers/logistics/core/declarants_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/logistics/core/declarants_controller.rb', line 12 def create @declarant = Declarant.new(declarant_params) if @declarant.save response = Mks::Common::MethodResponse.new(true, 'Declarant saved successfully!', @declarant, nil, nil) else errors = Mks::Common::Util. @declarant, 'Declarant' response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end |
#index ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/logistics/core/declarants_controller.rb', line 6 def index declarants = Declarant.all response = Mks::Common::MethodResponse.new(true, nil, declarants, nil, nil) render json: response end |
#update ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/logistics/core/declarants_controller.rb', line 23 def update if @declarant.update(declarant_params) response = Mks::Common::MethodResponse.new(true, "Declarant updated successfully!", @declarant, nil, nil) else errors = Mks::Common::Util. @declarant, "Declarant" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end |