diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2018-05-28 18:08:16 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2018-05-28 18:08:16 +0200 |
commit | 3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac (patch) | |
tree | 539ee170ff00b4d40312c280b155c574986bdbd8 | |
parent | 4c7f345fda0533e81ec3082247e05172b2f7fe4c (diff) | |
download | rails-3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac.tar.gz rails-3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac.tar.bz2 rails-3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac.zip |
Implicit transformation to html-safe string ready for display
-rw-r--r-- | app/models/action_text/rich_text.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb index e4fc178ba4..6747def9a5 100644 --- a/app/models/action_text/rich_text.rb +++ b/app/models/action_text/rich_text.rb @@ -2,7 +2,6 @@ class ActionText::RichText < ActiveRecord::Base self.table_name = "action_text_rich_texts" serialize :body, ActionText::Content - delegate :to_s, to: :body belongs_to :record, polymorphic: true, touch: true has_many_attached :embeds @@ -10,4 +9,9 @@ class ActionText::RichText < ActiveRecord::Base after_save do self.embeds_blobs = body.attachments.map(&:attachable) end + + + def to_s + body.to_s.html_safe + end end |