This repository was archived by the owner on Jul 24, 2020. It is now read-only.
This repository was archived by the owner on Jul 24, 2020. It is now read-only.
Reservation generator hard-fails in seeds script #629
Closed
Description
Currently, the seeds script stops if the Reservation generator creates an object that fails validation. This usually happens for two reasons:
- A previously generated Blackout occurs during start or end date of the Reservation
- A previously generated Reservation overlaps with the currently generated object
The probability of validation failure increases with the number of Reservations and Blackouts generated.
There are two possible solutions. I favor the second.
- Write Reservation-generating logic that will prevent conflicts
- Wrap the current Reservation-generating logic in a
begin..rescue ActiveRecord::RecordInvalid { continue }
block, which ignores the error but allows the seeds script to continue.
Thoughts?
Activity