Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load action_mailer lazily #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/email_prefixer/railtie.rb
Expand Up @@ -2,13 +2,19 @@ module EmailPrefixer
class Railtie < ::Rails::Railtie
initializer 'email_prefixer.configure_defaults' do |app|
config = EmailPrefixer.configure do |config|
config.application_name ||= app.class.parent_name
config.application_name ||= if app.class.respond_to?(:module_parent_name)
app.class.module_parent_name
else
app.class.parent_name
end
config.stage_name ||= Rails.env
config.builder ||= EmailPrefixer::Configuration::DEFAULT_BUILDER
end
interceptor = EmailPrefixer::Interceptor.new(config)
ActionMailer::Base.register_preview_interceptor(interceptor)
ActionMailer::Base.register_interceptor(interceptor)
ActiveSupport.on_load :action_mailer do
register_preview_interceptor(interceptor)
register_interceptor(interceptor)
end
end
end
end
3 changes: 3 additions & 0 deletions spec/dummy/app/assets/config/manifest.js
@@ -0,0 +1,3 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css