diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/action_text/rich_text.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb index 7c0fdf240d..445b444867 100644 --- a/app/models/action_text/rich_text.rb +++ b/app/models/action_text/rich_text.rb @@ -6,6 +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) end |