This patch adds a LOAD_PATH-like behavior for template files by providing a facility for searching the file system for alternate base_paths in ActionView::Base.
It's becoming more common for certain applications or plugins to specify an alternate base path in ActionPack by overriding the full_template_path method in ActionView::Base. The scenario is this: if the normal template file exists, render it, but if it doesn't exist, first check some other directories in case it exists before reporting that the view file couldn't be rendered. An alternate scenario exists also: If a file exists elsewhere, render it first, otherwise render the normal template file. Unfortunately, if full_template_path is overridden by several packages or plugins to get this effect, then these plugins can't coexist.
James Adam uses this technique in his Engines plugin, as do I (canadaduane) in my Productized Rails App generator. There are also some other applications that use this technique for finding default partials in the shared folder.
In order to fix this inability to coexist, this patch adds two ActionView::Base class variables: @@alternate_base_paths_before and @@alternate_base_paths_after (both are arrays). These arrays, if non-empty, are used in the full_template_path method to resolve the problem cited above. Alternate base paths can be added to these arrays, and these alternate paths will be checked in sequence to see if an alternate file can be found. There is no file system performance hit if these arrays are empty.