Sha256: 4555403c85bc44edd07eab1a0bf8c864307bccfd6c4220c20d9695c2a457ab26
Contents?: true
Size: 1.43 KB
Versions: 5
Compression:
Stored size: 1.43 KB
Contents
class Notifier < ::ActionMailer::Base cattr_accessor :sender # Deliver confirmation instructions when the user is created or its email is # updated, and also when confirmation is manually requested def confirmation_instructions(record) setup_mail(record, :confirmation_instructions) end # Deliver reset password instructions when manually requested def reset_password_instructions(record) setup_mail(record, :reset_password_instructions) end private # Configure default email options def setup_mail(record, key) subject translate(record, key) from self.class.sender recipients record.email sent_on Time.now content_type 'text/html' body underscore_name(record) => record, :resource => record end # Setup subject namespaced by model. It means you're able to setup your # messages using specific resource scope, or provide a default one. # Example (i18n locale file): # # en: # devise: # notifier: # confirmation_instructions: '...' # user: # notifier: # confirmation_instructions: '...' def translate(record, key) I18n.t(:"#{underscore_name(record)}.#{key}", :scope => [:devise, :notifier], :default => key) end def underscore_name(record) @underscore_name ||= record.class.name.underscore.to_sym end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
devise-0.2.2 | app/models/notifier.rb |
devise-0.2.1 | app/models/notifier.rb |
devise-0.2.0 | app/models/notifier.rb |
devise-0.1.1 | app/models/notifier.rb |
devise-0.1.0 | app/models/notifier.rb |