Skip to content

Commit

Permalink
Merge pull request tscolari#1 from akito19/rails4251
Browse files Browse the repository at this point in the history
add arguments for find_templates
  • Loading branch information
akito19 committed Mar 25, 2016
2 parents 08781e2 + c3a9d1c commit d99b1e5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/mobylette/resolvers/chained_fallback_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand All @@ -39,13 +39,19 @@ 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 = nil)
# 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

if outside_app_allowed.nil?
# Consider the backward compatibility with older Rails
super(name, prefix, partial, details)
else
super(name, prefix, partial, details, outside_app_allowed)
end
super(name, prefix, partial, details)
end

# Helper for building query glob string based on resolver's pattern.
Expand Down

0 comments on commit d99b1e5

Please sign in to comment.