From da2c92377c7f36469e56dc25a4ac0604157ac778 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Thu, 28 Mar 2019 18:52:02 -0400 Subject: Add load hook for ActiveStorage::Attachment --- activestorage/app/models/active_storage/attachment.rb | 2 ++ activestorage/app/models/active_storage/blob.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'activestorage') diff --git a/activestorage/app/models/active_storage/attachment.rb b/activestorage/app/models/active_storage/attachment.rb index 13758d9179..874ba80ca8 100644 --- a/activestorage/app/models/active_storage/attachment.rb +++ b/activestorage/app/models/active_storage/attachment.rb @@ -46,3 +46,5 @@ class ActiveStorage::Attachment < ActiveRecord::Base record.attachment_reflections[name]&.options[:dependent] end end + +ActiveSupport.run_load_hooks :active_storage_attachment, ActiveStorage::Attachment diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb index 38757d8f92..c9fbafad1f 100644 --- a/activestorage/app/models/active_storage/blob.rb +++ b/activestorage/app/models/active_storage/blob.rb @@ -273,6 +273,6 @@ class ActiveStorage::Blob < ActiveRecord::Base { content_type: content_type } end end - - ActiveSupport.run_load_hooks(:active_storage_blob, self) end + +ActiveSupport.run_load_hooks :active_storage_blob, ActiveStorage::Blob -- cgit v1.2.3