In a Rails (6) app (with PG), I have the Office
model with room_ids
which is an array of UUID
s
t.uuid room_ids, array: true
Is there a way to raise some kind of PG Error
* when an office is created with room_ids containing other than UUIDs?
Office.create(room_ids: [1])
should raise such Error.
But now
Office.create(room_ids: [1])
=> #<Office id: "24e835df-aed9-4d48-8855-82670375c374", room_ids: [nil]>
- I'm not looking for Active Record Validations