lib/devise/mailers/helpers.rb in devise-2.2.0.rc vs lib/devise/mailers/helpers.rb in devise-2.2.0

- old
+ new

@@ -9,13 +9,13 @@ end protected # Configure default email options - def devise_mail(record, action) + def devise_mail(record, action, opts={}) initialize_from_record(record) - mail headers_for(action) + mail headers_for(action, opts) end def initialize_from_record(record) @scope_name = Devise::Mapping.find_scope!(record) @resource = instance_variable_set("@#{devise_mapping.name}", record) @@ -23,19 +23,22 @@ def devise_mapping @devise_mapping ||= Devise.mappings[scope_name] end - def headers_for(action) + def headers_for(action, opts) headers = { :subject => translate(devise_mapping, action), :to => resource.email, :from => mailer_sender(devise_mapping), :reply_to => mailer_reply_to(devise_mapping), - :template_path => template_paths - } + :template_path => template_paths, + :template_name => action + }.merge(opts) if resource.respond_to?(:headers_for) + ActiveSupport::Deprecation.warn "Calling headers_for in the model is no longer supported. " << + "Please customize your mailer instead." headers.merge!(resource.headers_for(action)) end @email = headers[:to] headers