forked from OpenNeo/impress
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:
parent
3c567e0ba1
commit
69c98ec35e
1 changed files with 2 additions and 2 deletions
|
@ -53,7 +53,7 @@ class Contribution < ActiveRecord::Base
|
||||||
# Load contributed objects without parents, prepare them for easy access
|
# Load contributed objects without parents, prepare them for easy access
|
||||||
# for future assignment to contributions and looking up parents
|
# for future assignment to contributions and looking up parents
|
||||||
CONTRIBUTED_CHILDREN.each do |type|
|
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|
|
scope.find(needed_ids_by_type[type]).each do |contributed|
|
||||||
contributed_by_type[type] << contributed
|
contributed_by_type[type] << contributed
|
||||||
contributed_by_type_and_id[type][contributed.id] = 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
|
# contributed objects of that class. all_by_ids_or_children properly
|
||||||
# assigns parents to children, as well
|
# assigns parents to children, as well
|
||||||
CONTRIBUTED_RELATIONSHIPS.each do |child_type, type|
|
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]
|
ids = needed_ids_by_type[type]
|
||||||
children = contributed_by_type[child_type]
|
children = contributed_by_type[child_type]
|
||||||
scope.all_by_ids_or_children(ids, children).each do |contributed|
|
scope.all_by_ids_or_children(ids, children).each do |contributed|
|
||||||
|
|
Loading…
Reference in a new issue