From 3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 28 May 2018 18:08:16 +0200 Subject: Implicit transformation to html-safe string ready for display --- app/models/action_text/rich_text.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/models') 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 -- cgit v1.2.3