Efficient algorithm to check dates overlap – Rails Guides
26-Sep-2019 2003
Picture this. A real estate site’s guest wants to book a hotel for specific dates. The system should check whether these dates are available, i.e. if they are not overlapping with some other existing booking. Let’s say, software engineers have written this hypothetical site in Rails and have come up with Booking model. It represents bookings table with two columns: start_date and end_date of date type. Also suppose, there is a validation somewhere checking start_date <= end_date. The solution below describes how to cope with this specific situation. Similar data models can follow it, though.
Efficient algorithm to check dates overlap – Rails Guides #ruby #rubydeveloper #rubyonrails #Efficient #algorithm #check #dates #overlap #Rails #Guides #guides https://rubyonrails.ba/link/efficient-algorithm-to-check-dates-overlap-rails-guides