http://www.justinweiss.com/blog/2015/06/23/how-to-preload-rails-scopes
It seems Scopes can result in N+1 queries if not used properly since they cannot be preloaded...And author shows a way of how to use them correctly (i.e. without resulting in N+1 queries).
To learn about eager loading - http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
More on the topic:
It seems Scopes can result in N+1 queries if not used properly since they cannot be preloaded...And author shows a way of how to use them correctly (i.e. without resulting in N+1 queries).
To learn about eager loading - http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
More on the topic:
No comments:
Post a Comment