From 531d7dd584267e81ba57d4de7f0fe21b18a83cbb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 12 Sep 2018 15:51:06 -0700 Subject: Never mind on allowing blank More hassle than its worth. Just account for the fact that rich text can be blank instead, but continue to create the record. --- app/models/action_text/rich_text.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app/models') diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb index 445b444867..0b6043bd74 100644 --- a/app/models/action_text/rich_text.rb +++ b/app/models/action_text/rich_text.rb @@ -6,10 +6,8 @@ class ActionText::RichText < ActiveRecord::Base belongs_to :record, polymorphic: true, touch: true has_many_attached :embeds - validate { errors.add(:body, "is missing") if body.blank? } - before_save do - self.embeds = body.attachments.map(&:attachable) + self.embeds = body.attachments.map(&:attachable) if body.present? end def to_s -- cgit v1.2.3