class SlotBooking < ApplicationRecord
belongs_to :booking
belongs_to :slot
delegate :start_time, :end_time, to: :slot
validates :price, presence: true
end
class Slot < ApplicationRecord
belongs_to :program
has_many :slot_bookings, dependent: :destroy
end
a = SlotBooking.includes(:slot).select("to_char(slots.start_time, 'mm/dd/yy') as start_date").ref
erences(:slots)
a.first.start_date
yields following output
