From 48c6ef9a7236a17799bb5d217fef721afdf06f44 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Fri, 25 Jan 2019 16:44:35 -0500 Subject: Fix error saving Action Text content containing non-blob attachables Failing test before the ActionText::RichText change: ``` Error: ActionText::ModelTest#test_embed_extraction_only_extracts_file_attachments: ArgumentError: Could not find or build blob: expected attachable, got # ``` --- actiontext/app/models/action_text/rich_text.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actiontext/app') diff --git a/actiontext/app/models/action_text/rich_text.rb b/actiontext/app/models/action_text/rich_text.rb index 1f39bc51b9..19fa3e030e 100644 --- a/actiontext/app/models/action_text/rich_text.rb +++ b/actiontext/app/models/action_text/rich_text.rb @@ -15,7 +15,7 @@ module ActionText has_many_attached :embeds before_save do - self.embeds = body.attachments.map(&:attachable) if body.present? + self.embeds = body.attachables.grep(ActiveStorage::Blob) if body.present? end def to_plain_text -- cgit v1.2.3