vendor/plugins/engines/lib/engines/action_view_extensions.rb in parlement-0.6 vs vendor/plugins/engines/lib/engines/action_view_extensions.rb in parlement-0.7

- old
+ new

@@ -1,20 +1,24 @@ require 'fileutils' module ::ActionView class Base + private def full_template_path(template_path, extension) - # If the template exists in the normal application directory, - # return that path - default_template = "#{@base_path}/#{template_path}.#{extension}" - return default_template if File.exist?(default_template) + unless Engines.disable_app_views_loading + # If the template exists in the normal application directory, + # return that path + default_template = "#{@base_path}/#{template_path}.#{extension}" + return default_template if File.exist?(default_template) + end # Otherwise, check in the engines to see if the template can be found there. # Load this in order so that more recently started Engines will take priority. - Engines.active.each do |engine| - site_specific_path = File.join(engine.root, 'app', 'views', template_path.to_s + '.' + extension.to_s) + Engines.each(:precidence_order) do |engine| + site_specific_path = File.join(engine.root, 'app', 'views', + template_path.to_s + '.' + extension.to_s) return site_specific_path if File.exist?(site_specific_path) end # If it cannot be found anywhere, return the default path, where the # user *should* have put it.