From 3a963c7d2579ea6c4f6b34adfd6df7f16a26d4b5 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 9 Nov 2023 21:35:42 -0800 Subject: [PATCH] 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! --- app/models/item.rb | 10 +++++----- app/models/pet.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/item.rb b/app/models/item.rb index c0df4953..a842e53e 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -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 diff --git a/app/models/pet.rb b/app/models/pet.rb index eb6491f3..4b97b008 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -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]