Skip to content

Instantly share code, notes, and snippets.

@quirkey
Created August 29, 2008 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quirkey/7891 to your computer and use it in GitHub Desktop.
Save quirkey/7891 to your computer and use it in GitHub Desktop.
module ActionMailer
class Base
class_inheritable_accessor :view_paths
def self.prepend_view_path(path)
view_paths.unshift(*path)
ActionView::TemplateFinder.process_view_paths(path)
end
def self.append_view_path(path)
view_paths.push(*path)
ActionView::TemplateFinder.process_view_paths(path)
end
private
def self.view_paths
@@view_paths ||= [template_root]
end
def view_paths
self.class.view_paths
end
def initialize_template_class(assigns)
ActionView::Base.new(view_paths, assigns, self)
end
end
end
ActionMailer::Base.prepend_view_path('/my/other/path/to/search/first/')
# or
ActionMailer::Base.append_view_path('/my/other/path/to/search/last/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment