From 6bbd8e552ea13e72698b7e3bb24c9bc4dc84a36e Mon Sep 17 00:00:00 2001 From: Ian White Date: Tue, 3 Mar 2009 09:29:09 +0000 Subject: [PATCH] Update method signature of find_template to match current rails edge (2.3) --- lib/inherit_views.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/inherit_views.rb b/lib/inherit_views.rb index 209a24c..c03fa66 100644 --- a/lib/inherit_views.rb +++ b/lib/inherit_views.rb @@ -98,21 +98,21 @@ class PathSet < ::ActionView::PathSet alias_method :orig_find_template, :find_template # look for a parent template if a standard one can't be found - def find_template(template_path, format = nil) + def find_template(template_path, format = nil, html_fallback = true) super rescue ::ActionView::MissingTemplate find_parent_template(template_path, format) end # given a template_path and format, returns a parent template, or raise ActionView::MissingTemplate - def find_parent_template(template_path, format = nil) + def find_parent_template(template_path, format = nil, html_fallback = true) # first, we grab the inherit view paths that are 'above' the given template_path if inherit_view_paths.present? && (starting_path = inherit_view_paths.detect {|path| template_path.starts_with?("#{path}/")}) parent_paths = inherit_view_paths.slice(inherit_view_paths.index(starting_path)+1..-1) # then, search through each path, substituting the inherit view path, returning the first found parent_paths.each do |path| begin - return orig_find_template(template_path.sub(/^#{starting_path}/, path), format) + return orig_find_template(template_path.sub(/^#{starting_path}/, path), format, html_fallback) rescue ::ActionView::MissingTemplate next end