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

#assign_pdm_template(template) ⇒ Object



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

def assign_pdm_template(template)
  return unless template.formats.include?(:html)
  message.template_html = template.source
  message.template_assigns = view_assigns_with_pdm
end

#render_with_pdm(opts) ⇒ Object



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

def render_with_pdm(opts)
  unless ::Pdm::Rails::Delivery === message.delivery_method
    return render_without_pdm(opts)
  end

  if message.delivery_method.personalization?
    assign_pdm_template(opts[:template])
  end
  
  "" # The result of this method is shoved in 'body'
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