aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/action_text/rich_text.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/action_text/rich_text.rb')
-rw-r--r--app/models/action_text/rich_text.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb
index 1f8ac0e7f7..d44046e863 100644
--- a/app/models/action_text/rich_text.rb
+++ b/app/models/action_text/rich_text.rb
@@ -8,8 +8,12 @@ class ActionText::RichText < ActiveRecord::Base
self.table_name = "action_text_rich_texts"
serialize :body, ActionText::Content
- delegate :to_s, :to_plain_text, :nil?, to: :body
- delegate :blank?, :empty?, :present?, to: :to_s
+ delegate :to_s, :nil?, to: :body
+ delegate :blank?, :empty?, :present?, to: :to_plain_text
+
+ def to_plain_text
+ body&.to_plain_text.to_s
+ end
belongs_to :record, polymorphic: true, touch: true
has_many_attached :embeds