Sha256: d8c5c28e791c06669d24987e6e3d09d5a4e83bfb7c3a6f8d95769757f893b544

Contents?: true

Size: 593 Bytes

Versions: 136

Compression:

Stored size: 593 Bytes

Contents

module Comee
  module Core
    class TimeSlot < ApplicationRecord
      belongs_to :transport_availability

      validates :from, :to, presence: true
      validate :validate_time_range

      def validate_time_range
        return unless from && to

        errors.add(:base, "From must be before to.") if from >= to
      end

      def self.ransackable_attributes(_auth_object = nil)
        %w[from id to transport_availability_id created_at updated_at]
      end

      def self.ransackable_associations(_auth_object = nil)
        ["transport_availability"]
      end
    end
  end
end

Version data entries

136 entries across 136 versions & 1 rubygems

Version Path
comee_core-0.3.62 app/models/comee/core/time_slot.rb
comee_core-0.3.61 app/models/comee/core/time_slot.rb
comee_core-0.3.60 app/models/comee/core/time_slot.rb
comee_core-0.3.59 app/models/comee/core/time_slot.rb
comee_core-0.3.58 app/models/comee/core/time_slot.rb
comee_core-0.3.57 app/models/comee/core/time_slot.rb
comee_core-0.3.56 app/models/comee/core/time_slot.rb
comee_core-0.3.55 app/models/comee/core/time_slot.rb
comee_core-0.3.54 app/models/comee/core/time_slot.rb
comee_core-0.3.53 app/models/comee/core/time_slot.rb
comee_core-0.3.51 app/models/comee/core/time_slot.rb
comee_core-0.3.50 app/models/comee/core/time_slot.rb
comee_core-0.3.49 app/models/comee/core/time_slot.rb
comee_core-0.3.48 app/models/comee/core/time_slot.rb
comee_core-0.3.47 app/models/comee/core/time_slot.rb
comee_core-0.3.46 app/models/comee/core/time_slot.rb
comee_core-0.3.45 app/models/comee/core/time_slot.rb
comee_core-0.3.44 app/models/comee/core/time_slot.rb
comee_core-0.3.43 app/models/comee/core/time_slot.rb
comee_core-0.3.42 app/models/comee/core/time_slot.rb