Module: ReservationHistory

Overview

This module use for search history reservation either old or new reservation and give you return reservation ids The result was saved on history result method History method for search the reservation id and write it on history_result method You can read more on 3.basecamp.com/5190892/buckets/27028666/documents/5085824516

Instance Method Summary collapse

Instance Method Details

#history(id) ⇒ Object



10
11
12
13
14
15
16
17
# File 'app/controllers/reservation_history.rb', line 10

def history(id)
  reservation = Reservation.fetch(id)
  if reservation.old_reservation_id.present? && history_result.add?(reservation.old_reservation_id)
    history(reservation.old_reservation_id)
  end
  next_booking = Reservation.find_by old_reservation_id: id
  history(next_booking.id) if next_booking && history_result.add?(next_booking.id)
end

#history_resultObject



6
7
8
# File 'app/controllers/reservation_history.rb', line 6

def history_result
  @result ||= Set.new
end