Sha256: b8f12a7f5678cd0a93ef39405671f2f387c6d027add0b4655c9e4d873e1f3e79

Contents?: true

Size: 378 Bytes

Versions: 9

Compression:

Stored size: 378 Bytes

Contents

module Logistics
  module Core
    class InterCityRoute < Route
      validates :from_id, :to_id, presence: true, allow_blank: false
      validates :from_id, uniqueness: {scope: [:from_id, :to_id]}
      validate :check_from_id_and_to_id

      def check_from_id_and_to_id
        errors.add(:from_id, "can't be the same as to.") if from_id == to_id
      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/inter_city_route.rb
logistics_core-21.11.1 app/models/logistics/core/inter_city_route.rb
logistics_core-21.08.1 app/models/logistics/core/inter_city_route.rb
logistics_core-21.03.1 app/models/logistics/core/inter_city_route.rb
logistics_core-20.10.3 app/models/logistics/core/inter_city_route.rb
logistics_core-20.10.2 app/models/logistics/core/inter_city_route.rb
logistics_core-20.10.1 app/models/logistics/core/inter_city_route.rb
logistics_core-20.9.1 app/models/logistics/core/inter_city_route.rb
logistics_core-20.8.1 app/models/logistics/core/inter_city_route.rb