Class: Posthaste::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/posthaste/railtie.rb

Overview

What the Railtie is for — and it is one specific thing.

config.action_mailer.posthaste_settings = { … } only works if add_delivery_method(:posthaste, …) has already defined that accessor when Rails applies the config.action_mailer.* options. Rails applies them in its own action_mailer.set_configs initializer.

The ActiveSupport.on_load(:action_mailer) hook in actionmailer.rb normally wins that race on its own, because the gem is required by Bundler.require before any initializer runs and load hooks fire in registration order. It does NOT win when the gem is listed as require: false and required later from config/initializers/…, which is a completely ordinary thing to do — and the failure mode is a NoMethodError: undefined method 'posthaste_settings=' from production.rb, pointing at the configuration rather than at the ordering.

before: 'action_mailer.set_configs' removes the race in both cases.