From c03870fe177776b9b70f2bd8511caf4f04905049 Mon Sep 17 00:00:00 2001 From: andrew nimmo Date: Fri, 3 Jan 2025 02:46:15 -0800 Subject: [PATCH] fix remaining --- app/models/observation.rb | 4 ++-- app/models/user.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/observation.rb b/app/models/observation.rb index 1fb100b30f..a5b5b4125a 100644 --- a/app/models/observation.rb +++ b/app/models/observation.rb @@ -758,7 +758,7 @@ def self.refresh_content_filter_caches(dry_run: false) def self.refresh_cached_column(type: nil, foreign: nil, local: foreign, dry_run: false) tbl = type.camelize.constantize.arel_table - query = Observation.joins(type.to_sym). + query = Observation.unscoped.joins(type.to_sym). where(Observation[local.to_sym].not_eq(tbl[foreign.to_sym])) msgs = query.map do |obs| "Fixing #{type} #{foreign} for obs ##{obs.id}, " \ @@ -778,7 +778,7 @@ def self.refresh_cached_column(type: nil, foreign: nil, local: foreign, # date. Fixes and returns a messages for each one that was wrong. # Used by refresh_caches script def self.make_sure_no_observations_are_misspelled(dry_run: false) - query = Observation.joins(:name). + query = Observation.unscoped.joins(:name). where(Name[:correct_spelling_id].not_eq(nil)) msgs = query.pluck(Observation[:id], Name[:text_name]). map do |id, search_name| diff --git a/app/models/user.rb b/app/models/user.rb index 9d65b30fe9..b16fb486e3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -578,12 +578,12 @@ def in_group?(group) # Return an Array of Project's that this User is an admin for. def projects_admin - Project.joins(:admin_group_users).where(user_id: id) + Project.unscoped.joins(:admin_group_users).where(user_id: id) end # Return an Array of Project's that this User is a member of. def projects_member(order: :created_at, include: nil) - @projects_member ||= Project.where(user_group: user_groups.ids). + @projects_member ||= Project.unscoped.where(user_group: user_groups.ids). includes(include).order(order).to_a end