diff --git a/Gemfile.lock b/Gemfile.lock index 4c62c6da3..1158c91f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -362,7 +362,7 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.0) - rubocop (1.56.3) + rubocop (1.56.4) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -385,7 +385,7 @@ GEM rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) + rubocop-rails (2.21.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -453,7 +453,7 @@ GEM concurrent-ruby (~> 1.0) tzinfo-data (1.2023.2) tzinfo (>= 1.0.0) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) view_component (3.6.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) diff --git a/app/controllers/concerns/model_filters.rb b/app/controllers/concerns/model_filters.rb index 1002dd426..ed94e5403 100644 --- a/app/controllers/concerns/model_filters.rb +++ b/app/controllers/concerns/model_filters.rb @@ -10,7 +10,7 @@ def get_filters end def process_filters_init - @models = Model.all.includes(:tags, :preview_file, :creator, :collection) + @models = Model.includes(:tags, :preview_file, :creator, :collection) end def process_filters_tags_fetchall diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index 68921485d..2ce1c4dff 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -49,7 +49,7 @@ def scan_all if params[:type] === "check" Scan::CheckAllJob.perform_later else - Library.all.each do |library| + Library.find_each do |library| Scan::DetectFilesystemChangesJob.perform_later(library.id) end end diff --git a/app/jobs/scan/check_all_job.rb b/app/jobs/scan/check_all_job.rb index b0ca38845..ded27fe3e 100644 --- a/app/jobs/scan/check_all_job.rb +++ b/app/jobs/scan/check_all_job.rb @@ -3,7 +3,7 @@ class Scan::CheckAllJob < ApplicationJob def perform # Run integrity check on all models - Model.all.each do |model| + Model.find_each do |model| Scan::CheckModelIntegrityJob.perform_later(model.id) # Run analysis job on individual files model.model_files.each do |file| diff --git a/db/data/20221214230757_add_new_defaults_to_renderer_settings.rb b/db/data/20221214230757_add_new_defaults_to_renderer_settings.rb index 0fc164798..184eba2e0 100644 --- a/db/data/20221214230757_add_new_defaults_to_renderer_settings.rb +++ b/db/data/20221214230757_add_new_defaults_to_renderer_settings.rb @@ -9,7 +9,7 @@ def up "object_colour" => "#cccccc", "render_style" => "normals" } - User.all.each do |user| + User.find_each do |user| user.update( renderer_settings: defaults.merge(user.renderer_settings) ) diff --git a/db/data/20221220223040_move_printed_to_favorites.rb b/db/data/20221220223040_move_printed_to_favorites.rb index 3ad5d103e..48f87735d 100644 --- a/db/data/20221220223040_move_printed_to_favorites.rb +++ b/db/data/20221220223040_move_printed_to_favorites.rb @@ -8,7 +8,7 @@ def up # If there's more than one, this might be a bad choice, # but it's better than nothing user = User.first - ModelFile.where(printed: true).each do |file| + ModelFile.where(printed: true).find_each do |file| user.favorite(file, scope: :printed) end end diff --git a/db/data/20230221174212_move_scale_factor_into_note.rb b/db/data/20230221174212_move_scale_factor_into_note.rb index 56aafabf4..3af5aedb1 100644 --- a/db/data/20230221174212_move_scale_factor_into_note.rb +++ b/db/data/20230221174212_move_scale_factor_into_note.rb @@ -2,7 +2,7 @@ class MoveScaleFactorIntoNote < ActiveRecord::Migration[7.0] def up - Model.all.each do |model| + Model.find_each do |model| if defined?(model.scale_factor) && (model.scale_factor != 100) model.update!(notes: [ model.notes, diff --git a/db/data/20230308006000_move_collection_tag_into_object.rb b/db/data/20230308006000_move_collection_tag_into_object.rb index 66b5531af..917b78e9c 100644 --- a/db/data/20230308006000_move_collection_tag_into_object.rb +++ b/db/data/20230308006000_move_collection_tag_into_object.rb @@ -2,7 +2,7 @@ class MoveCollectionTagIntoObject < ActiveRecord::Migration[7.0] def up - Model.all.each do |model| + Model.find_each do |model| if defined?(model.collections) && !model.collection model.collections.each do |collection| newcol = Collection.find_or_create_by name: collection.name diff --git a/db/data/20230613134254_remove_leading_separators_from_model_filenames.rb b/db/data/20230613134254_remove_leading_separators_from_model_filenames.rb index fcf269773..d6833f81e 100644 --- a/db/data/20230613134254_remove_leading_separators_from_model_filenames.rb +++ b/db/data/20230613134254_remove_leading_separators_from_model_filenames.rb @@ -2,7 +2,7 @@ class RemoveLeadingSeparatorsFromModelFilenames < ActiveRecord::Migration[7.0] def up - Model.all.each do |model| + Model.find_each do |model| model.update! path: model.path&.trim_path_separators rescue ActiveRecord::RecordInvalid # If the path is invalid as it's already taken, this is a duplicate, so destroy it. diff --git a/db/data/20230617222353_generate_slugs.rb b/db/data/20230617222353_generate_slugs.rb index a2c0d4480..325802f3c 100644 --- a/db/data/20230617222353_generate_slugs.rb +++ b/db/data/20230617222353_generate_slugs.rb @@ -2,15 +2,15 @@ class GenerateSlugs < ActiveRecord::Migration[7.0] def up - Model.where(slug: nil).each do |model| + Model.where(slug: nil).find_each do |model| model.send(:slugify_name) model.save!(validate: false) end - Creator.where(slug: nil).each do |creator| + Creator.where(slug: nil).find_each do |creator| creator.send(:slugify_name) creator.save!(validate: false) end - Collection.where(slug: nil).each do |collection| + Collection.where(slug: nil).find_each do |collection| collection.send(:slugify_name) collection.save!(validate: false) end