From 4d1f3f832485920a5bd49bc3a2c13debeaab5608 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Fri, 21 Dec 2018 00:59:43 -0500 Subject: Move method definition below callbacks --- app/models/action_text/rich_text.rb | 11 ++++++----- 1 file 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 -- cgit v1.2.3