Skip to content

Add a simpler way to select multiple ids #140

Description

@mculp

Right now, I have to do something like this to query by more than one ID:

ids = [1, 2]

id_clause = " AND Id IN %|('#{ids.join("', '")}')|" if extracted_ids.any?

SELECT Id, DisplayName, CompanyName, BillAddr, PrimaryEmailAddr, PrimaryPhone FROM Vendor WHERE Active = true#{id_clause} ORDER DisplayName

Or when selecting all columns:

ids = [1, 2]
client.all(:vendors,  [ 'Id', 'IN', %|('#{ids.join("', '")}')| ])

Maybe something like this would be better:

client.all(:vendors, id: [1, 2])
client.get(:vendors, id: [1, 2])

Should also be pretty straightforward. I’ll see if I have time for this as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions