Class: Comee::Core::TimeSlot

Inherits:
ApplicationRecord show all
Defined in:
app/models/comee/core/time_slot.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ransackable_associations(_auth_object = nil) ⇒ Object



19
20
21
# File 'app/models/comee/core/time_slot.rb', line 19

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

.ransackable_attributes(_auth_object = nil) ⇒ Object



15
16
17
# File 'app/models/comee/core/time_slot.rb', line 15

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

Instance Method Details

#validate_time_rangeObject



9
10
11
12
13
# File 'app/models/comee/core/time_slot.rb', line 9

def validate_time_range
  return unless from && to

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