From 2ae84d647feac338082175f581bd1ca0c33d003a Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Tue, 13 Feb 2018 15:07:29 -0500 Subject: Initial Attachment rendering support --- lib/active_text/attachment.rb | 6 +++++- lib/active_text/content.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/active_text') diff --git a/lib/active_text/attachment.rb b/lib/active_text/attachment.rb index 870390f63e..e349c721b2 100644 --- a/lib/active_text/attachment.rb +++ b/lib/active_text/attachment.rb @@ -74,7 +74,11 @@ module ActiveText end def to_html - HtmlConversion.node_to_html(node) + if attachable.respond_to?(:to_partial_path) + ApplicationController.render(self) + else + HtmlConversion.node_to_html(node) + end end def to_s diff --git a/lib/active_text/content.rb b/lib/active_text/content.rb index 0154cea17e..c9546fb4c5 100644 --- a/lib/active_text/content.rb +++ b/lib/active_text/content.rb @@ -46,7 +46,7 @@ module ActiveText end def to_html - fragment.to_html + render_attachments(&:to_html).to_html end def to_s -- cgit v1.2.3