Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Subquery generation when using a Relation as a parameter in regular where() #414

Description

@gamov

I've noticed that in my updated app, subqueries are generated when I supply a relation in a regular where():

Draft.where(id: Draft.limit(2)) 
# => SELECT "drafts".* FROM "drafts" WHERE "drafts"."id" IN (SELECT "drafts"."id" FROM "drafts" LIMIT 2)

This introduces a subquery instead of standard Rails array of ids:

# => SELECT "drafts".* FROM "drafts" WHERE "drafts"."id" IN (1,2)

IMO, Squeel should only work this kind of magic inside a where{} block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions