We're using datagrid gem together with draper decorators.
They works very well so far, until recently datagrid introduces preload feature, where it actively preloads associations when rendering a ActiveRecord resource.
To fix this breaking change, we have to implement #preload in our Draper::CollectionDecorator subclasses:
class MyCollectionDecorator < Draper::CollectionDecorator
def preload(*args)
object.preload(*args).decorate
end
end
I wonder if it makes sense to move this #preload implementation into Draper::CollectionDecorator?
What do you all think?
We're using datagrid gem together with draper decorators.
They works very well so far, until recently datagrid introduces preload feature, where it actively preloads associations when rendering a ActiveRecord resource.
To fix this breaking change, we have to implement
#preloadin ourDraper::CollectionDecoratorsubclasses:I wonder if it makes sense to move this
#preloadimplementation intoDraper::CollectionDecorator?What do you all think?