Skip to content

Rails 3 (Mail 2.5) support

Kirill Shnurov edited this page Feb 25, 2016 · 4 revisions

merge_vars/global_merge_vars/templates

To make them work with Rails 3 (Mail 2.5), you should monkey-patch you Mail class with this code:

require 'mail'

module MailFieldMonkeyPatch
  def initialize(name, value = nil, charset = 'utf-8')
    @value = value unless defined?(@value)
    super
  end
end

module Mail
  class Field
    prepend MailFieldMonkeyPatch
  end
end

This patch should work on Ruby 2.0+!

Ruby 1.9 users would need to use alias_method to get prepend-like functionality. stackoverflow example

Clone this wiki locally