kaspth / oaken

A fresh blended alternative to Fixtures & FactoryBot for dev and test data.
MIT License
175 stars 6 forks source link

Support UUID as IDs #85

Open marcelolx opened 3 weeks ago

marcelolx commented 3 weeks ago

Something like this is needed, otherwise it won't pass the UUID as a string to find

kaspth commented 3 weeks ago

Huh, I see. It's possible we want to generate the method based on ActiveRecord::Base::primary_key.

Probably to support composite primary keys as well, which are an Array.

jamie commented 2 days ago

Would "def #{label} = find(#{record.id.inspect})" solve the interpolation here? That'll keep integers plain, wrap UUID strings in quotes, and should handle array keys sanely as well (unless the composite key has eg. a Date column included).