Class: DbMailerRails::Base
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- DbMailerRails::Base
- Defined in:
- lib/db_mailer_rails/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
7 8 9 |
# File 'lib/db_mailer_rails/base.rb', line 7 def object @object end |
Instance Method Details
#build(object = nil, **_args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/db_mailer_rails/base.rb', line 9 def build(object = nil, **_args) self.object = object replacer = Replacer.new(fields_with_data) finder = TemplateFinder.new(self.class) template = finder.db_mail_template mail_params = { from: replacer.replace(template.from), to: replacer.replace(template.to), subject: replacer.replace(template.subject) } # add attachments to mail mail(mail_params) do |format| format.html { render html: replacer.replace(template.body).html_safe, layout: layout_by_environment } end end |
#fields ⇒ Object
29 30 31 |
# File 'lib/db_mailer_rails/base.rb', line 29 def fields {} end |
#mail_attachments ⇒ Object
33 34 |
# File 'lib/db_mailer_rails/base.rb', line 33 def end |