From d1f50a4cbe54d15a07608b20ed2fc05e8960bc1d Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Tue, 13 Feb 2018 15:00:14 -0600 Subject: Preserve the outer attachment element and fix editing --- lib/active_text/attachment.rb | 6 +----- lib/active_text/content.rb | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/active_text/attachment.rb b/lib/active_text/attachment.rb index e349c721b2..870390f63e 100644 --- a/lib/active_text/attachment.rb +++ b/lib/active_text/attachment.rb @@ -74,11 +74,7 @@ module ActiveText end def to_html - if attachable.respond_to?(:to_partial_path) - ApplicationController.render(self) - else - HtmlConversion.node_to_html(node) - end + HtmlConversion.node_to_html(node) end def to_s diff --git a/lib/active_text/content.rb b/lib/active_text/content.rb index c9546fb4c5..190f7d3c7b 100644 --- a/lib/active_text/content.rb +++ b/lib/active_text/content.rb @@ -46,7 +46,11 @@ module ActiveText end def to_html - render_attachments(&:to_html).to_html + render_attachments do |attachment| + attachment.node.tap do |node| + node.inner_html = ApplicationController.render(attachment) + end + end.to_html end def to_s -- cgit v1.2.3