diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/action_text/rich_text.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb index d44046e863..717e93599f 100644 --- a/app/models/action_text/rich_text.rb +++ b/app/models/action_text/rich_text.rb @@ -9,11 +9,6 @@ class ActionText::RichText < ActiveRecord::Base serialize :body, ActionText::Content 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 @@ -21,4 +16,10 @@ class ActionText::RichText < ActiveRecord::Base before_save do self.embeds = body.attachments.map(&:attachable) if body.present? end + + def to_plain_text + body&.to_plain_text.to_s + end + + delegate :blank?, :empty?, :present?, to: :to_plain_text end |