Skip to content

Goldiloader for Arrays #170

@apauly

Description

@apauly

There might be situations where it's not possible to use a simple ActiveRecord::Relation. So, I was wondering if there is already a way to add the auto_include_context logic to a plain array of records?

Correct me if I'm wrong, but I didn't find any obvious out-of-the-box solution for this scenario.

I was thinking about sth like this:

records = Goldiloader::Collection.new([record_a])
records << record_b
records << record_c

records.map { _1.auto_include_context.models.count }
=> [3, 3, 3]

Would you be interested in a PR adding that functionality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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