Class: ActionMailer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pdm-rails/ext/action_mailer/base.rb

Instance Method Summary collapse

Instance Method Details

#apply_personalizationObject



13
14
15
# File 'lib/pdm-rails/ext/action_mailer/base.rb', line 13

def apply_personalization
  message.personalization = view_assigns_with_pdm
end

#render_with_pdm(opts) ⇒ Object

The result of this method is shoved in ‘message.body’



18
19
20
21
22
23
24
25
26
# File 'lib/pdm-rails/ext/action_mailer/base.rb', line 18

def render_with_pdm(opts)
  if ::Pdm::Rails::Delivery === message.delivery_method &&
      message.delivery_method.personalization?
    apply_personalization
    return opts[:template].source
  end

  return render_without_pdm(opts)
end

#view_assigns_with_pdmObject



6
7
8
9
10
# File 'lib/pdm-rails/ext/action_mailer/base.rb', line 6

def view_assigns_with_pdm
  view_assigns_without_pdm.tap do |view_assigns|
    view_assigns.delete("_message")
  end
end