JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Controls to disable eager loading

Open
#484 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

I have some situations where I'm loading an included resource that lives in a different DB than the primary resource being loaded. AR.includes as it is called in Resource.apply_includes method breaks it. I am avoiding this by overriding apply_includes to skip eager loading for certain resource names, but I have a distaste for overriding more methods than I need to out of concern for long term brittleness of my codebase.

I'd like to add this option to resource associations eager_load: false. Anyone have initial feedback?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Resource.apply_includes and the AR.includes call described in the issue, then inspect how resource associations are defined and processed. Determine the behavior needed for an eager_load: false association and identify or add coverage for resources backed by different databases; done means those associations no longer trigger eager loading while other includes retain their behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.