Skip to content

Fix embedded factory override handling for non-hash values#68

Merged
BillyRuffian merged 2 commits into
BillyRuffian:masterfrom
mjrisaac:bugfix/embedded-factory-override-handling
Jul 22, 2026
Merged

Fix embedded factory override handling for non-hash values#68
BillyRuffian merged 2 commits into
BillyRuffian:masterfrom
mjrisaac:bugfix/embedded-factory-override-handling

Conversation

@mjrisaac

Copy link
Copy Markdown

Fix type error when overriding an embedded factory attribute with a non-hash value

value_for_attribute checked !attr.embedded_factories? before checking for an override. This meant non-hash overrides (e.g. FakerMaker::OMIT, nil) for embedded factory attributes weren't taken into account. The method fell through to building the embedded factory which then failed with a undefined method error .

Fix: Check overridden_value? first, then only delegate to the embedded factory build when the override is a Hash. Non-hash overrides are now returned directly, allowing FakerMaker::OMIT and nil to work as expected for embedded attributes.

Mark Isaac added 2 commits July 14, 2026 13:17
@BillyRuffian
BillyRuffian merged commit 2615ce4 into BillyRuffian:master Jul 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants