ulid-rails
ulid-rails copied to clipboard
ulid :id, auto_generate: false raises ULID::Rails::ArgumentError when id is generated by a DB function
Hi, I'm experimenting with the gem, I find it interesting. However, I have some concerns.
I have a pqsl function generate_ulid()
which generates ulid ids by default.
The app that creates those records is not AR, and relies on DB function to generate ulid ids.
In Rails app on the model for the same table I configured id column not to auto_generate. When creating a record, it raises is not a ULID format on a BYTEA value e.g. \x018d7baa2b659d7042f45c3ab047c082.
While debugging, I noticed that when creating a record with ulid-rails valid_ulid?
is called 11 times. Some room for improvement...
Also, optimisation-wise, do you think I should implement ulid generation with ruby code on the other app, or fix the issue here?
I'd be happy to contribute, just want your advice here as well ;)