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.
This commit is contained in:
Matchu 2023-07-29 12:06:26 -07:00 committed by Matchu
parent 5da4006053
commit 2dd9cfb3d5

View file

@ -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|