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

Proposal / potential PR: Support for custom load parameters #762

@fgrehm

Description

@fgrehm

Hey @karmi,

I've just started experimenting with the code below and I was wondering if it is something that could be added to Tire's core or to tire-contrib:

Tire::Results::Collection.class_eval do
  def __find_records_by_ids(klass, ids)
    if @options[:load].is_a?(Hash)
      klass.find(ids, @options[:load][klass])
    else
      @options[:load] === true ? klass.find(ids) : klass.find(ids, @options[:load])
    end
  end
end

The idea would be to support fine grained eager loading on multi model searches. If you think it is a nice idea, I'd be more than happy to turn this issue into a proper pull request either here or on tire-contrib :)

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