view vendor/plugins/prepend_engine_views/init.rb @ 647:525f48af3f54 feature_36

Shorten email address in search results, showing domain only (text too long otherwise) Apply min-width to search results box Remove initialisation of search results in edit action (fixing #287)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 09 Sep 2011 12:24:45 +0100
parents 513646585e45
children
line wrap: on
line source
module PrependEngineViews
  def self.included(base)
    base.send(:include, InstanceMethods)
    base.class_eval do
      alias_method_chain :add_engine_view_paths, :prepend
    end
  end

  module InstanceMethods
    # Patch Rails so engine's views are prepended to the view_path,
    # thereby letting plugins override application views
    def add_engine_view_paths_with_prepend
      paths = ActionView::PathSet.new(engines.collect(&:view_path))
      ActionController::Base.view_paths.unshift(*paths)
      ActionMailer::Base.view_paths.unshift(*paths) if configuration.frameworks.include?(:action_mailer)
    end
  end
end

Rails::Plugin::Loader.send :include, PrependEngineViews