active-hash / active_hash

A readonly ActiveRecord-esque base class that lets you use a hash, a Yaml file or a custom file as the datasource
MIT License
1.2k stars 178 forks source link

Fix the behavior when passing nil to `exists?` #320

Closed y-yagi closed 2 months ago

y-yagi commented 2 months ago

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.

kbrock commented 2 months ago

thank you @y-yagi