diff options
author | George Claghorn <george@basecamp.com> | 2018-12-21 00:59:43 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-12-21 00:59:43 -0500 |
commit | 4d1f3f832485920a5bd49bc3a2c13debeaab5608 (patch) | |
tree | 26070b13cb9ef6c2415ac45a54a890a1ea9af14c | |
parent | 086cc2b68e62a68fb378f4d039cfb55b3fdcb7de (diff) | |
download | rails-4d1f3f832485920a5bd49bc3a2c13debeaab5608.tar.gz rails-4d1f3f832485920a5bd49bc3a2c13debeaab5608.tar.bz2 rails-4d1f3f832485920a5bd49bc3a2c13debeaab5608.zip |
Move method definition below callbacks
-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 |