Skip to content

Commit

Permalink
Rails 7 removed clear_association_cache
Browse files Browse the repository at this point in the history
We can manually clear it ourselves.

See:
commit dd5886d00a2d5f31ccf504c391aad93deb014eb8
Author: Ryuta Kamizono <[email protected]>
Date:   Mon May 3 12:13:19 2021 +0900

    Remove unused `clear_association_cache`

    It is no longer used since #41112.
  • Loading branch information
jrafanie committed Feb 7, 2024
1 parent 1874bc3 commit a6c9982
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,5 @@ def build_authentication_by_role(options)
update_authentication(creds, options)
end

def clear_association_cache
@storages = nil
super
end

define_method(:allow_duplicate_endpoint_url?) { false }
end
6 changes: 3 additions & 3 deletions app/models/pxe_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def discovered_images

def default_pxe_image_for_windows=(image)
image.update(:default_for_windows => true)
clear_association_cache
self.instance_variable_set :@association_cache, {}
end

def default_pxe_image_for_windows
Expand All @@ -44,7 +44,7 @@ def default_pxe_image_for_windows
def synchronize_advertised_images
pxe_menus.each(&:synchronize)
sync_windows_images
clear_association_cache
self.instance_variable_set :@association_cache, {}
update_attribute(:last_refresh_on, Time.now.utc)
end

Expand All @@ -59,7 +59,7 @@ def synchronize_advertised_images_queue
def sync_images
sync_pxe_images
sync_windows_images
clear_association_cache
self.instance_variable_set :@association_cache, {}
update_attribute(:last_refresh_on, Time.now.utc)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def set_quotas(quotas)
# Delete any quotas that were not passed in
tenant_quotas.destroy_missing(updated_keys)
# unfortunatly, an extra scope is created in destroy_missing, so we need to reload the records
clear_association_cache
self.instance_variable_set :@association_cache, {}
end

get_quotas
Expand Down
2 changes: 1 addition & 1 deletion tools/fix_binary_blobs_and_parts_size_column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
end

# clear the binary_blob_parts from memory
bb.send(:clear_association_cache)
bb.send(:self.instance_variable_set :@association_cache, {})
end

0 comments on commit a6c9982

Please sign in to comment.