Class: Logistics::Core::SpecialIncrementContentRatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::SpecialIncrementContentRatesController
- Defined in:
- app/controllers/logistics/core/special_increment_content_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_content_rates_controller.rb', line 16 def create errors = [] content_increment = SpecialIncrementContentRate.new(content_increment_params) if content_increment.valid? content_increment.save response = Mks::Common::MethodResponse.new(true, 'Content increment successfully created',nil,nil,nil) else errors = Mks::Common::Util.(content_increment, 'ContentIncrement') 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_content_rates_controller.rb', line 5 def index content_increments = SpecialIncrementContentRate.all content_increments_array = [] content_increments.each { |ci| content_increments_array.push({:id => ci.id, :content_type_id => ci.content_type_id, :content_type_name => ci.content_type.name, :rate => ci.rate, :effective_date => ci.effective_date}) } response = Mks::Common::MethodResponse.new(true,nil,content_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_content_rates_controller.rb', line 29 def update @content_increment.update_attributes(content_increment_params) if @content_increment.save response = Mks::Common::MethodResponse.new(true, 'Content increment updated successfully !',nil,nil,nil) render json: response else errors = Mks::Common::Util.(@content_increment, 'ContentIncrement') response = Mks::Common::MethodResponse.new(false,nil,nil,errors,nil) render json: response end end |