Created by: ineu
When working with large datasets, simple .all
can cause N+1 if related objects are used in display_resource
. This PR allows to pass the scope explicitly.
The scope
is passed in a callable to avoid arguments being resolved while preloading dashboards. I.e.
ATTRIBUTE_TYPES = {
collection: Field::BelongsTo.with_options(
scope: -> { Collection.where(created_at < Date.today).includes(:something) }),