From a73ed222336982dad853db8c1a3d6d581cc40946 Mon Sep 17 00:00:00 2001 From: Joshua Pinter Date: Mon, 15 Jan 2024 15:09:18 -0500 Subject: [PATCH] Add Rails 7.1 support. Handle when `string` is a `ActionView::OutputBuffer` by converting it to a `String` first. Pulled from https://github.com/zombocom/maildown/pull/71. --- lib/maildown/markdown_engine.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/maildown/markdown_engine.rb b/lib/maildown/markdown_engine.rb index 1d86efb..1b7bf9f 100644 --- a/lib/maildown/markdown_engine.rb +++ b/lib/maildown/markdown_engine.rb @@ -20,10 +20,12 @@ module MarkdownEngine @maildown_markdown_engine_text_block = nil def self.to_html(string) + string = string.to_s if string.is_a?(ActionView::OutputBuffer) # Needed for Rails 7.1 support. See https://github.com/zombocom/maildown/pull/71 html_block.call(string) end def self.to_text(string) + string = string.to_s if string.is_a?(ActionView::OutputBuffer) # Needed for Rails 7.1 support. See https://github.com/zombocom/maildown/pull/71 text_block.call(string) end