1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Move template_paths to its own module.

This commit is contained in:
José Valim 2010-07-05 13:27:15 +02:00
parent f54013a181
commit 35923c9c69

View file

@ -22,14 +22,11 @@ class Devise::Mailer < ::ActionMailer::Base
@devise_mapping = Devise.mappings[@scope_name]
@resource = instance_variable_set("@#{@devise_mapping.name}", record)
template_path = [self.class.mailer_name]
template_path.unshift "#{@devise_mapping.plural}/mailer" if self.class.scoped_views?
headers = {
:subject => translate(@devise_mapping, action),
:from => mailer_sender(@devise_mapping),
:to => record.email,
:template_path => template_path
:template_path => template_paths
}
headers.merge!(record.headers_for(action)) if record.respond_to?(:headers_for)
@ -44,6 +41,12 @@ class Devise::Mailer < ::ActionMailer::Base
end
end
def template_paths
template_path = [self.class.mailer_name]
template_path.unshift "#{@devise_mapping.plural}/mailer" if self.class.scoped_views?
template_path
end
# Setup a subject doing an I18n lookup. At first, it attemps to set a subject
# based on the current mapping:
#