Open
Description
Is your feature request related to a problem? Please describe.
If there is multiple (especially) multiline where
, merging only the last into exists
doesn't improve the readability.
Example
User
.joins(:profile)
.where(profile: { kind: "bar" }
.where.not(attr1: "foo")
.where(attr2: "bar")
.exists?
Currently it enforces
User
.joins(:profile)
.where(profile: { kind: "bar" }
.where.not(attr1: "foo")
.exists?(attr2: "bar")
Describe the solution you'd like
Allow exists
at the end of multi-line chain, even after .where
Describe alternatives you've considered
I may merge some where clauses, but not all of them (e.g. with not
for instance) - so having both where
and exists?
looks strange to me.
# group all possible where (except not)
User
.joins(:profile)
.where.not(attr1: "foo")
.exists?(profile: { kind: "bar" }, attr2: "bar")
# put joins and related where at one line
User
.joins(:profile).where(profile: { kind: "bar"})
.where.not(attr1: "foo")
.exists?(attr2: "bar")
Also.. I prefer to have single exists?
over where.exists?
for simple cases, so using EnforcedStyle: where
is not an option for me.
Metadata
Metadata
Assignees
Labels
No labels