Datamapper 中多对多关系的策略性预加载?
我正在使用 DataMapper,这是一个用于 ruby 的开源 ORM,我很渴望想抓挠。目前,DataMapper 可以对一对多关系使用策略性预加载 (SEL),但不能对发生 N+1 查询的多对多关系使用。我想设法使其正常工作,但我找不到在哪里可以做到这一点。所以问题分为两部分:
- 如何运行测试套件,以便它显示此测试失败(注意,现在所有应该失败的规范都标记为待处理)?
- 在哪里以及如何为一对多关系实施 SEL?
I'm using DataMapper, an open source ORM for ruby, and I have in itch I would like to scratch. At the moment, DataMapper can use Strategic Eager Loading(SEL) for one-to-many relationships, but not many-to-many, where N+1 queries occur. I would like to hack around with making this work correctly, but I cannot find where to do it. So two part question:
- How to I run the test suite so it will show this to be failing (nb. right now all the specs that should be failing are marked as pending)?
- Where and how is SEL implemented for one-to-many relationships?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于第二个问题,您可以尝试深入研究代码:
/lib/dm-core/associations/relationship.rb
./lib/dm-core/associations/one_to_many.rb:
For second question, you could try dive into code:
/lib/dm-core/associations/relationship.rb
./lib/dm-core/associations/one_to_many.rb: