To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / .svn / pristine / b6 / b6683def4ff299aa9cca77fe57bb77ce73743047.svn-base @ 1297:0a574315af3e

History | View | Annotate | Download (687 Bytes)

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