Open rchav opened 1 year ago
This is technically a misuse of the API (excluding the main model's fields from the result means that its id
is not available), but Fluent should not cause an inexplicable "unexpectedly found nil" fatal error in this case. Since it is API misuse, it should be a fatal error, but at the very least it should have a clear explanation and since the problem can be detected before the query actually runs, it definitely should be.
Additional notation: We could implicitly include the appropriate ID column regardless of the user's configuration, but doing so risks changing the functional meaning of a query, such as when using .unique()
to deduplicate results.
Describe the bug
See discussion in Discord for full context: https://discord.com/channels/431917998102675485/1146265856834281573/1146265856834281573
Seeing a crash when using
.fields()
or.field()
on a QueryBuilder object that has optional relations (Siblings + OptionalParents in this case)Crash text:
Expected behavior
Should not crash, return results for pagination.
Environment
Additional context
cc: @gwynne