From 2dd9cfb3d557e9c231440d282ec882fc4382033b Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 29 Jul 2023 12:06:26 -0700 Subject: [PATCH] Use `all` instead of `scoped` Back in the day, `all` would immediately load up a query into an array, but now I think it's an alias for what `scoped` used to be: a relation that contains everything. --- app/models/contribution.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/contribution.rb b/app/models/contribution.rb index bda74a40..c48bfc97 100644 --- a/app/models/contribution.rb +++ b/app/models/contribution.rb @@ -53,7 +53,7 @@ class Contribution < ActiveRecord::Base # Load contributed objects without parents, prepare them for easy access # for future assignment to contributions and looking up parents CONTRIBUTED_CHILDREN.each do |type| - scope = options[:scopes][type] || type.constantize.scoped + scope = options[:scopes][type] || type.constantize.all scope.find(needed_ids_by_type[type]).each do |contributed| contributed_by_type[type] << contributed contributed_by_type_and_id[type][contributed.id] = contributed @@ -64,7 +64,7 @@ class Contribution < ActiveRecord::Base # contributed objects of that class. all_by_ids_or_children properly # assigns parents to children, as well CONTRIBUTED_RELATIONSHIPS.each do |child_type, type| - scope = options[:scopes][type] || type.constantize.scoped + scope = options[:scopes][type] || type.constantize.all ids = needed_ids_by_type[type] children = contributed_by_type[child_type] scope.all_by_ids_or_children(ids, children).each do |contributed|