aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-09-12 15:51:06 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-09-12 15:51:06 -0700
commit531d7dd584267e81ba57d4de7f0fe21b18a83cbb (patch)
tree1e65cf6bda11cc03bdcebdc9183a84abb5aef58c /app
parent3431c0b3eeaf284901bd9aa4265c578207d4c820 (diff)
downloadrails-531d7dd584267e81ba57d4de7f0fe21b18a83cbb.tar.gz
rails-531d7dd584267e81ba57d4de7f0fe21b18a83cbb.tar.bz2
rails-531d7dd584267e81ba57d4de7f0fe21b18a83cbb.zip
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.
Diffstat (limited to 'app')
-rw-r--r--app/models/action_text/rich_text.rb4
1 files changed, 1 insertions, 3 deletions
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