Sha256: b903614222b17937182a9a6aa9005f8d9e6a8b2740b49bbc18834b5e24a13049

Contents?: true

Size: 814 Bytes

Versions: 9

Compression:

Stored size: 814 Bytes

Contents

module Logistics
  module Core
    class EslTransportTariffRate < ApplicationRecord
      belongs_to :esl_transport_tariff
      validates :esl_transport_tariff, :qt_from, :qt_to, :rate, presence: true
      validates_uniqueness_of :esl_transport_tariff, :scope => [:qt_from, :qt_to]

      def to_json
        JSON.parse(
          Jbuilder.encode do |json|
            json.id self.id
            json.esl_transport_tariff_id self.esl_transport_tariff_id
            json.esl_transport_tariff_name self.esl_transport_tariff ?
                                             "#{self.esl_transport_tariff.name} (#{self.esl_transport_tariff.storage_point})" : ''
            json.qt_from self.qt_from
            json.qt_to self.qt_to
            json.rate self.rate
          end
        )
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-21.11.1 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-21.08.1 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-21.03.1 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-20.10.3 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-20.10.2 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-20.10.1 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-20.9.1 app/models/logistics/core/esl_transport_tariff_rate.rb
logistics_core-20.8.1 app/models/logistics/core/esl_transport_tariff_rate.rb