Requiring mail/check_delivery_params before mail itself has been required creates an empty top-level constant Mail which prevents autoloading Mail itself or any of its contents, causing problems like:
$ rails console
Loading development environment (Rails 5.0.0.1)
irb> Mail.new
NoMethodError: undefined method `new' for Mail:Module
This is the simplest solution: require mail itself before requiring the check delivery params module. But this means that folks including letter_opener in rails during development will now be pre-loading all of the mail gem every time they boot rails. I'll address this in another PR to add autoloading.
Requiring
mail/check_delivery_params
beforemail
itself has been required creates an empty top-level constantMail
which prevents autoloadingMail
itself or any of its contents, causing problems like:because:
This happens because letter opener is requiring
mail/check_delivery_params
which defines an empty Mail module. Requiring mail itself fixes this:This is the simplest solution: require mail itself before requiring the check delivery params module. But this means that folks including letter_opener in rails during development will now be pre-loading all of the mail gem every time they boot rails. I'll address this in another PR to add autoloading.