class ActiveBookings::Booking

Booking model. Store in database bookings made by bookers on bookables

Private Instance Methods

bookable_must_be_bookable() click to toggle source

Validation method. Check if the bookable resource is actually bookable

# File lib/active_bookings/booking.rb, line 28
def bookable_must_be_bookable
  if bookable.present? && !bookable.class.bookable?
    errors.add(:bookable, T.er('booking.bookable_must_be_bookable', model: bookable.class.to_s))
  end
end
booker_must_be_booker() click to toggle source

Validation method. Check if the booker model is actually a booker

# File lib/active_bookings/booking.rb, line 35
def booker_must_be_booker
  if booker.present? && !booker.class.booker?
    errors.add(:booker, T.er('booking.booker_must_be_booker', model: booker.class.to_s))
  end
end