equivalent / public_uid

Automatically generates random unique public id for record.
MIT License
76 stars 8 forks source link

Allow calling generate_uid on before_validation #22

Open phuibonhoa opened 1 year ago

phuibonhoa commented 1 year ago

It would be nice to be able to set validations on the unique id column. Letting someone set the callback to be before_validation instead of before_create means you are guaranteed to have the unique ID set so that validations can be run. Likewise, it makes it easier to backfill or update records that already exist since you can simply set the column to nil before saving to update it.

Right now since it is on before_create there is no way to have validations on the column.

equivalent commented 1 year ago

hi @phuibonhoa interesting point, please give me couple of weeks to think about this 🤔. ..I'm bit overwhelmed at the moment with some circumstances . I'll address this ASAP