From 977fa6ef0cd99ec17c8f362ba99c629a6576f6d1 Mon Sep 17 00:00:00 2001 From: Rob Di Marco Date: Mon, 25 Jan 2016 18:32:50 -0500 Subject: [PATCH 1/2] Handle change in Rails 4.2.5.1 where find_templates now takes a fifth argument --- lib/mobylette/resolvers/chained_fallback_resolver.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mobylette/resolvers/chained_fallback_resolver.rb b/lib/mobylette/resolvers/chained_fallback_resolver.rb index 24cca05..092a803 100644 --- a/lib/mobylette/resolvers/chained_fallback_resolver.rb +++ b/lib/mobylette/resolvers/chained_fallback_resolver.rb @@ -24,9 +24,9 @@ def initialize(formats = {}, view_paths = ['app/views']) # ... # } # - # It will add the fallback chain array of the + # It will add the fallback chain array of the # request.format to the resolver. - # + # # If the format.request is not defined in formats, # it will behave as a normal FileSystemResovler. # @@ -39,13 +39,13 @@ def replace_fallback_formats_chain(formats) # Private: finds the right template on the filesystem, # using fallback if needed # - def find_templates(name, prefix, partial, details) + def find_templates(name, prefix, partial, details, outside_app_allowed = false) # checks if the format has a fallback chain if @fallback_formats.has_key?(details[:formats].first) details = details.dup - details[:formats] = Array.wrap(@fallback_formats[details[:formats].first]) + details[:formats] = Array.wrap(@fallback_formats[details[:formats].first]) end - super(name, prefix, partial, details) + super(name, prefix, partial, details, outside_app_allowed) end # Helper for building query glob string based on resolver's pattern. From d6c8b8db7a97db975ba6870916485a7a55ffbdf9 Mon Sep 17 00:00:00 2001 From: Rob Di Marco Date: Mon, 25 Jan 2016 18:50:27 -0500 Subject: [PATCH 2/2] Do not send 5th argument to maintain backwards compatibility --- lib/mobylette/resolvers/chained_fallback_resolver.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mobylette/resolvers/chained_fallback_resolver.rb b/lib/mobylette/resolvers/chained_fallback_resolver.rb index 092a803..ec6f870 100644 --- a/lib/mobylette/resolvers/chained_fallback_resolver.rb +++ b/lib/mobylette/resolvers/chained_fallback_resolver.rb @@ -45,7 +45,8 @@ def find_templates(name, prefix, partial, details, outside_app_allowed = false) details = details.dup details[:formats] = Array.wrap(@fallback_formats[details[:formats].first]) end - super(name, prefix, partial, details, outside_app_allowed) + # Skip fifth argument for compatability with older Rails version + super(name, prefix, partial, details) end # Helper for building query glob string based on resolver's pattern.