Sha256: e331ddbb014ca16cc9eb878738228b0cce0b9a5a12c2f8b839d7c05596b53c98
Contents?: true
Size: 612 Bytes
Versions: 3
Compression:
Stored size: 612 Bytes
Contents
module Effective class EmailTemplatesMailer < ::ActionMailer::Base def mail(headers = {}, &block) email_template = Effective::EmailTemplate.where(template_name: action_name).first! assigns = route_url_assigns(email_template).merge(@assigns || {}) rendered = email_template.render(assigns) super(rendered.merge(headers)) end private def route_url_assigns(email_template) email_template.template_variables.select { |name| name.ends_with?('_url') }.inject({}) do |h, name| h[name] = public_send(name) if respond_to?(name); h end end end end
Version data entries
3 entries across 3 versions & 1 rubygems