Fix old .scoped -> .all Rails upgrade bug

Ahh, I guess I missed these, I think they're maybe not actually used in
the app is why? cuz they're all default values that are overridden at
the actual call sites. But I ran into it when running `Pet.load` in the
console, and yeah let's just fix 'em up!
This commit is contained in:
Emi Matchu 2023-11-09 21:35:42 -08:00
parent c9dd0f7376
commit 3a963c7d25
2 changed files with 6 additions and 6 deletions

View file

@ -185,7 +185,7 @@ class Item < ApplicationRecord
end
def restricted_zones(options={})
options[:scope] ||= Zone.scoped
options[:scope] ||= Zone.all
options[:scope].find(restricted_zone_ids)
end
@ -204,7 +204,7 @@ class Item < ApplicationRecord
end
def occupied_zones(options={})
options[:scope] ||= Zone.scoped
options[:scope] ||= Zone.all
all_body_ids = []
zone_body_ids = {}
selected_assets = swf_assets.select('body_id, zone_id').each do |swf_asset|
@ -370,7 +370,7 @@ class Item < ApplicationRecord
inject({}) { |h, pt| h[pt.species_id] = pt.body_id; h }
end
def predicted_missing_standard_body_ids_by_species(species_scope=Species.scoped)
def predicted_missing_standard_body_ids_by_species(species_scope=Species.all)
species = species_scope.where(id: predicted_missing_standard_body_ids_by_species_id.keys)
species_by_id = species.inject({}) { |h, s| h[s.id] = s; h }
predicted_missing_standard_body_ids_by_species_id.inject({}) { |h, (sid, bid)|
@ -383,7 +383,7 @@ class Item < ApplicationRecord
colors: {standard: false})
end
def predicted_missing_nonstandard_body_ids_by_species_by_color(colors_scope=Color.scoped, species_scope=Species.scoped)
def predicted_missing_nonstandard_body_ids_by_species_by_color(colors_scope=Color.all, species_scope=Species.all)
pet_types = predicted_missing_nonstandard_body_pet_types
species_by_id = {}
@ -555,7 +555,7 @@ class Item < ApplicationRecord
end
end
def self.collection_from_pet_type_and_registries(pet_type, info_registry, asset_registry, scope=Item.scoped)
def self.collection_from_pet_type_and_registries(pet_type, info_registry, asset_registry, scope=Item.all)
# bear in mind that registries are arrays with many nil elements,
# due to how the parser works

View file

@ -27,7 +27,7 @@ class Pet < ApplicationRecord
end
def use_viewer_data(viewer_data, options={})
options[:item_scope] ||= Item.scoped
options[:item_scope] ||= Item.all
pet_data = viewer_data[:custom_pet]