Open MarcusRiemer opened 11 months ago
Within the context @pyromaniac, I think we can close this "bug". It's more like a configurable feature.
p.s. this feature was a surprise to me, too.
I'd suggest a more prominent announcement, e.g., at the top of the README, to close this one out. Call it an inadvertent breaking change and point to the docs for how to get the old behavior.
I'm happy that there is a feasible way to revert back to the old behavior and this has addressed my personal needs. I do however agree with @BiggerNoise : a more prominent mention would be very helpful. What about either:
Agree that being able to revert to the previous behavior has met my needs as well.
I think @MarcusRiemer documentation suggestions would be very helpful, would a P/R be helpful?
One issue with turning off via config.factory_bot.reject_primary_key_attributes = false
is that for Rails engines this needs to go in the dummy app, not in say spec_helper.
Seems like the kind of breaking change that should warrant a major version number increment.
Description
We are modeling tree structures in with
UUID
primary keys. We specifically choseUUID
as type because among other benefits we can generate those IDs in the application and send whole trees to the database in a single transaction without having to go back and forth for each new node we are inserting.Reproduction Steps
We have this factory:
Expected behavior
The instance should be constructed with identical values for
id
androot_id
(as was the case with FactoryBot 6.2.0). Alternatively we would be fine with overriding this behavior but browsing the Readme or the web for "Do not define "id". Instead, rely on the database to generate it." didn't yield any helpful results.Actual behavior
Creating instances worked just fine with FactoryBot
6.2.0
, but since at latest6.4.2
this results in the following error:System configuration
factory_bot version: 6.4.2 rails version: 7.0.8 ruby version: 3.2.2