Files
fizzy/config/initializers/uuid_framework_models.rb
Donal McBreen 13db384648 Auto default for UUID primary keys
Patch load_schmema! to set the default value for UUID primary keys. This
removes the need to patch ApplicationRecord + Rails models individually.

It also means we no longer need to patch the default in for the integer
primary key in Search::Record::SQLite.
2025-12-03 14:27:52 +00:00

11 lines
415 B
Ruby

# Inject account associations into Rails framework models
Rails.application.config.to_prepare do
ActionText::RichText.belongs_to :account, default: -> { record.account }
ActiveStorage::Attachment.belongs_to :account, default: -> { record.account }
ActiveStorage::Blob.belongs_to :account, default: -> { Current.account }
ActiveStorage::VariantRecord.belongs_to :account, default: -> { blob.account }
end