Skip to content

Commit

Permalink
Patch for Rails 7
Browse files Browse the repository at this point in the history
Documented in #59. This class was removed from Rails 7. 

This causes an error on this line when trying to alias a method that does not exist https://github.com/zombocom/maildown/blob/cbf5b51e0867eab1ec945d38b5335f42139b0322/lib/maildown/ext/action_view.rb#L7.

The solution presented was to re-add the method. However simply doing this with a `defined?(OptimizedFileSystemResolver)` causes a load via zeitwork and also results in a crash.

The presence of this code appears to do nothing in Rails 7. It's basically a no-op that allows us to boot without erroring.
  • Loading branch information
schneems committed Jul 31, 2022
1 parent 9c68b81 commit 34cee13
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/maildown/ext/action_view.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# frozen_string_literal: true

if !defined?(ActionView::OptimizedFileSystemResolver)
module ActionView
# 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
end

# This monkeypatch allows the use of `.md.erb` file extensions
# in addition to `.md+erb` and `.md`
module ActionView
Expand Down

0 comments on commit 34cee13

Please sign in to comment.