diff --git a/activestorage/CHANGELOG.md b/activestorage/CHANGELOG.md index 5a369383e5..5705649c35 100644 --- a/activestorage/CHANGELOG.md +++ b/activestorage/CHANGELOG.md @@ -1,3 +1,10 @@ +* Add a load hook called `active_storage_variant_record` (providing `ActiveStorage::VariantRecord`) + to allow for overriding aspects of the `ActiveStorage::VariantRecord` class. This makes + `ActiveStorage::VariantRecord` consistent with `ActiveStorage::Blob` and `ActiveStorage::Attachment` + that already have load hooks. + + *Brendon Muir* + * `ActiveStorage::PreviewError` is raised when a previewer is unable to generate a preview image. *Alex Robbin* diff --git a/activestorage/app/models/active_storage/variant_record.rb b/activestorage/app/models/active_storage/variant_record.rb index 4e552c63ec..0cc3fe3089 100644 --- a/activestorage/app/models/active_storage/variant_record.rb +++ b/activestorage/app/models/active_storage/variant_record.rb @@ -6,3 +6,5 @@ class ActiveStorage::VariantRecord < ActiveStorage::Record belongs_to :blob has_one_attached :image end + +ActiveSupport.run_load_hooks :active_storage_variant_record, ActiveStorage::VariantRecord diff --git a/guides/source/engines.md b/guides/source/engines.md index 277cb48d98..32703f6d40 100644 --- a/guides/source/engines.md +++ b/guides/source/engines.md @@ -1525,6 +1525,7 @@ These are the load hooks you can use in your own code. To hook into the initiali | `ActiveJob::TestCase` | `active_job_test_case` | | `ActiveRecord::Base` | `active_record` | | `ActiveStorage::Attachment` | `active_storage_attachment` | +| `ActiveStorage::VariantRecord` | `active_storage_variant_record` | | `ActiveStorage::Blob` | `active_storage_blob` | | `ActiveStorage::Record` | `active_storage_record` | | `ActiveSupport::TestCase` | `active_support_test_case` |