comparison vendor/plugins/prepend_engine_views/.svn/text-base/init.rb.svn-base @ 0:513646585e45

* Import Redmine trunk SVN rev 3859
author Chris Cannam
date Fri, 23 Jul 2010 15:52:44 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:513646585e45
1 module PrependEngineViews
2 def self.included(base)
3 base.send(:include, InstanceMethods)
4 base.class_eval do
5 alias_method_chain :add_engine_view_paths, :prepend
6 end
7 end
8
9 module InstanceMethods
10 # Patch Rails so engine's views are prepended to the view_path,
11 # thereby letting plugins override application views
12 def add_engine_view_paths_with_prepend
13 paths = ActionView::PathSet.new(engines.collect(&:view_path))
14 ActionController::Base.view_paths.unshift(*paths)
15 ActionMailer::Base.view_paths.unshift(*paths) if configuration.frameworks.include?(:action_mailer)
16 end
17 end
18 end
19
20 Rails::Plugin::Loader.send :include, PrependEngineViews
21