Ensure mailer view path is loaded when it's assigned. Path#[] raises if it isn't loaded.

This commit is contained in:
Jeremy Kemper 2008-07-31 17:51:43 -07:00
parent ad4553587e
commit 909a7f430b
2 changed files with 3 additions and 1 deletions

View File

@ -427,7 +427,7 @@ module ActionMailer #:nodoc:
def template_root=(root)
root = ActionView::PathSet::Path.new(root) if root.is_a?(String)
write_inheritable_attribute(:template_root, root)
write_inheritable_attribute(:template_root, root.load)
end
end

View File

@ -42,6 +42,7 @@ module ActionView #:nodoc:
end
def [](path)
raise "Unloaded view path! #{@path}" unless @loaded
@paths[path]
end
@ -51,6 +52,7 @@ module ActionView #:nodoc:
def load
reload! unless loaded?
self
end
# Rebuild load path directory cache