ef6198d394
to avoid implicitly creating a variant during a GET to a read replica, which will raise an exception and cause the image to fail to load. This feels pretty brittle, to be honest, and we'll need to be careful in the future about creating and using new variants; we will probably need to backfill the new variant for existing images because we can't guarantee that they will be created implicitly/lazily if the GET lands on the replica. ref: https://fizzy.37signals.com/5986089/collections/7/cards/942
21 lines
533 B
Ruby
21 lines
533 B
Ruby
module ActionText
|
|
module Extensions
|
|
module RichText
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
# This overrides the default :embeds association!
|
|
has_many_attached :embeds do |attachable|
|
|
::Attachments::VARIANTS.each do |variant_name, variant_options|
|
|
attachable.variant variant_name, variant_options.merge(preprocessed: true)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
ActiveSupport.on_load(:action_text_rich_text) do
|
|
include ActionText::Extensions::RichText
|
|
end
|