Closed eric1234 closed 7 years ago
Using more recent versions of Ruby means we can:
This PR relies on this assumption, but there is nothing preventing to use an older version of Ruby with this gem. In fact, this gem is supposed to be compatible with Rails 3 (and Ruby 1.9).
I will go ahead and merge, but I also have to plan upgrading the requirements.
@eric1234 can you try master and let me know if it works?
Yes my assumption is that people on older versions of Ruby can continue to use older versions of this gem. I should have some time tomorrow to try the merged version of this on an app (I was previously using my branch with success).
Using more recent versions of Ruby means we can:
send :include
hack.include
is now public.alias_method_chain
.prepend
is more flexible.class_eval
and instead prepend on thesingleton_class
In addition I:
ActiveSupport::Concern
to reduce the boilerplate. Since we are already using ActionMailer,ActiveSupport::Concern
will be avialable.The primary reason for this commit was to replace the
alias_method_chain
withprepend
. I'm want the request info to be used in Mandrill templated e-mails as well. I'm usingmandrill_mailer
gem which has a ActionMailer-like API. The default url options override that this gem provides couldn't be applied there becausedefault_url_options
is not a real method in mandrill_mailer soalias_method_chain
doesn't work. The more modernprepend
does work. This commit allows me to get use it for my purposes as well as modernize this gem a bit.For those wanting to also use it for the
mandrill_mailer
gem you just need to add the following to your initializer if using this commit: