From 3b0fbf5431ac5329ceccbd62a972c5faf50a5ae3 Mon Sep 17 00:00:00 2001 From: Moshe Kamensky Date: Thu, 21 Jul 2022 13:46:02 +0300 Subject: [PATCH] rails 7 fix --- lib/maildown/ext/action_view.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/maildown/ext/action_view.rb b/lib/maildown/ext/action_view.rb index 537cc1f..f2547a4 100644 --- a/lib/maildown/ext/action_view.rb +++ b/lib/maildown/ext/action_view.rb @@ -3,6 +3,20 @@ # This monkeypatch allows the use of `.md.erb` file extensions # in addition to `.md+erb` and `.md` module ActionView + + if !defined?(OptimizedFileSystemResolver) + # https://github.com/codetriage/maildown/issues/59 + # + # extract_handler_and_format_and_variant was removed in https://github.com/rails/rails/commit/2be8d3ebf85e26e936a7717b968737ee333d95bd + # OptimizedFileSystemResolver was removed in https://github.com/rails/rails/commit/faac734387124c6d780dbfcfdab721b2f26ce865 + class OptimizedFileSystemResolver < FileSystemResolver + def extract_handler_and_format_and_variant(template) + details = @path_parser.parse(template) + [details.handler, details.format, details.variant] + end + end + end + class OptimizedFileSystemResolver alias :original_extract_handler_and_format_and_variant :extract_handler_and_format_and_variant