Skip to content

Return an empty collection when where(:foo => []) is given#412

Open
chewi wants to merge 1 commit intoremi:masterfrom
yakara-ltd:where-empty-array
Open

Return an empty collection when where(:foo => []) is given#412
chewi wants to merge 1 commit intoremi:masterfrom
yakara-ltd:where-empty-array

Conversation

@chewi
Copy link
Copy Markdown
Contributor

@chewi chewi commented Aug 12, 2016

The previous behaviour was to return everything! This is now consistent with ActiveRecord and avoids a needless request.

The new behaviour is not applied to has_one associations as they currently seem to ignore the where method entirely.

@edtjones
Copy link
Copy Markdown
Collaborator

hi @chewi I've just got commit access on this repo and plan to get back on track with maintenance over time - will be in touch soon!

@chewi chewi force-pushed the where-empty-array branch from 032d88f to 96df4eb Compare February 20, 2017 14:58
@chewi
Copy link
Copy Markdown
Contributor Author

chewi commented Feb 20, 2017

Rebased.

@chewi chewi force-pushed the where-empty-array branch from 96df4eb to 25e8700 Compare November 10, 2017 17:21
@chewi
Copy link
Copy Markdown
Contributor Author

chewi commented Nov 10, 2017

Rebased again.

@chewi chewi force-pushed the where-empty-array branch from 25e8700 to 0901e9c Compare May 3, 2018 10:39
@chewi
Copy link
Copy Markdown
Contributor Author

chewi commented May 3, 2018

And again!

@chewi chewi force-pushed the where-empty-array branch from 0901e9c to 5f14a5b Compare June 1, 2018 15:01
The previous behaviour was to return everything! This is now
consistent with ActiveRecord and avoids a needless request.

The new behaviour is not applied to has_one associations as they
currently seem to ignore the where method entirely.
voltechs added a commit to TwilightCoders/her that referenced this pull request Mar 31, 2026
Ref: remi#412

Short-circuit to an empty Her::Collection when any query parameter
is an empty array, avoiding a pointless HTTP request that would
return all records instead of none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants