Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has_one relationship not working as expected. #358

Closed
josephmancuso opened this issue Feb 2, 2021 · 0 comments · Fixed by #362
Closed

has_one relationship not working as expected. #358

josephmancuso opened this issue Feb 2, 2021 · 0 comments · Fixed by #362
Labels
bug An existing feature is not working as intended

Comments

@josephmancuso
Copy link
Member

Describe the bug
has_one relationship not working as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Create a model
  2. use the with_ method to get the has one related model.
  3. You will hit a None type issue if one of the records are None
  4. One of the records should be NULL in order to reproduce the None query bindings

Expected behavior
Should exclude the None types from the query

Screenshots
Screenshots help a lot. If applicable, add screenshots to help explain your problem.
"that is exactly what I do. but because buyer_id might be NULL (no buyer yet) the second query fails:"

query: 'SELECT * FROM "users" WHERE "users"."None" IN (?)'
Binding ('2',)

What database are you using?

  • Type: [e.g. Postgres, MySQL, SQLite]
  • Version [e.g. 8, 9.1, 10.5]

Additional context

@josephmancuso josephmancuso added the bug An existing feature is not working as intended label Feb 2, 2021
@josephmancuso josephmancuso mentioned this issue Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant