Bugfix: Ensure that using id: [..] as condition returns unique records#266
Bugfix: Ensure that using id: [..] as condition returns unique records#266pfeiffer wants to merge 2 commits intoactive-hash:masterfrom
id: [..] as condition returns unique records#266Conversation
|
See also the #268 as an alternative which addresses the root of the issue. |
|
At this moment, I am leaning towards #268 |
It's actually two totally different cases; for For #196 I'm mentioning that attributes should be stored with strings as keys, as this is what ActiveModel concerns expect and use for instance when serializing with Please note that in #268 also fixes the issue in this PR and supersedes that. This PR is the "surgical" one fixing the bug, while #268 addresses the overall issue (and a lot more) giving a better structure going forward IMO. |
|
Going with #268 |
This PR fixes an issue where only unique records will be returned when using
where(id: ..). Previously, if the same ID was provided multiple times in theidcondition, more records than expected would be returned.This PR fixes the issue and now mimics the way ActiveRecord work. It also streamlines so that
query_hashalways has symbols as keys. We can usedeep_symbolize_keysfor this as there's already a dependency on ActiveSupport.Before
After