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

Fix the behavior when passing nil to exists? #320

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

y-yagi
Copy link
Contributor

@y-yagi y-yagi commented Aug 27, 2024

Currently, the behavior when passing nil to exists? doesn't match with Rails's behavior. Rails always returns false, but ActiveHash not. https://github.com/rails/rails/blob/5a0b2fa5a3be6ffd49fa7f1c3544c1da403c9cb5/activerecord/lib/active_record/relation/finder_methods.rb#L367

This PR changes the behavior to match with Rails's.

Currently, the behavior when passing `nil` to `exists?` doesn't match
with Rails's behavior. Rails always returns `false`, but ActiveHash not.
https://github.com/rails/rails/blob/5a0b2fa5a3be6ffd49fa7f1c3544c1da403c9cb5/activerecord/lib/active_record/relation/finder_methods.rb#L367

This PR changes the behavior to match with Rails's.
@y-yagi y-yagi marked this pull request as ready for review August 27, 2024 05:51
@kbrock
Copy link
Collaborator

kbrock commented Aug 27, 2024

thank you @y-yagi

@kbrock kbrock merged commit a192385 into active-hash:master Aug 27, 2024
19 checks passed
@kbrock kbrock added the bug label Aug 27, 2024
@y-yagi y-yagi deleted the fix_exists branch August 28, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants