NoBrainerORM / nobrainer

Ruby ORM for RethinkDB
http://nobrainer.io/
Other
386 stars 49 forks source link

Eager loading on polymorphic models #239

Closed marsadle closed 3 years ago

marsadle commented 7 years ago

Polymorphism with NoBrainer works great, for normal queries, but I need eager_loading, to speed up the code.

Right now it isn't possible to eager_load an association on a subclass, because NoBrainer always fetches the associations from root_class, which leads to an Unknown association error. This means, I can't preload any data and the library will load each model individually.

Is there a possible workaround for this, or will this be a feature in the future?

nviennot commented 7 years ago

It should work if you declare the association that you are trying to load in the root class

marsadle commented 7 years ago

That much I know, my issue is, that I can't do that.

nviennot commented 7 years ago

Can you provide a standalone script that would reproduce the issue? If so, it'll be much easier to me to make a fix Thank you :))

zedtux commented 3 years ago

I'm closing this issue due to its age but in the case it looks still relevant, please feel free to update it!