aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-05-28 18:08:16 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-05-28 18:08:16 +0200
commit3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac (patch)
tree539ee170ff00b4d40312c280b155c574986bdbd8 /app
parent4c7f345fda0533e81ec3082247e05172b2f7fe4c (diff)
downloadrails-3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac.tar.gz
rails-3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac.tar.bz2
rails-3a515bb3083f5e594b38ee7c9b8e2e755e2c19ac.zip
Implicit transformation to html-safe string ready for display
Diffstat (limited to 'app')
-rw-r--r--app/models/action_text/rich_text.rb6
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