JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Controls to disable eager loading

未关闭
#484 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Type: Enhancement
主要语言
Ruby
星标
2.3k
派生
546
PR 合并指标
30 天内没有已合并 PR

描述

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?

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Resource.apply_includes 和 issue 中描述的 AR.includes 调用开始,然后检查资源关联是如何定义和处理的。确定 eager_load: false 关联所需的行为,并识别或添加针对由不同数据库支持的资源的覆盖;完成的标准是这些关联不再触发 eager loading,同时其他 includes 保持原有行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
rails, ruby
领域
api, backend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。