Description
Now, where(undefined_key: nil) returns all records.
But I think where(undefined_key: nil) should raise an error because
- It's same as ActiveRecord behavior.
- We cannot recognize typo and get a surprising result.
Code to reproduce
class Records < ActiveHash::Base
self.data = [
{ id: 1, name: 'foo' },
{ id: 2, name: 'bar' },
{ id: 3, name: 'baz' }
]
end
pp Records.where(undefined_key: nil).to_a
# [
# #<Records:0x00007fadaf51a5e0 @attributes={:id=>1, :name=>"foo"}>,
# #<Records:0x00007fadaf519988 @attributes={:id=>2, :name=>"bar"}>,
# #<Records:0x00007fadaf519348 @attributes={:id=>3, :name=>"baz"}>
# ]
Other informations
- This will be breaking change
Description
Now,
where(undefined_key: nil)returns all records.But I think
where(undefined_key: nil)should raise an error becauseCode to reproduce
Other informations