File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -52,17 +52,17 @@ def config_default_preview_path(options)
52
52
end
53
53
54
54
def supports_action_mailer_previews? ( config )
55
- # If the action mailer railtie isn't loaded the config will not
56
- # respond.
55
+ # These checks avoid loading `ActionMailer`. Using `defined?` has the
56
+ # side-effect of the class getting loaded if it is available. This is
57
+ # problematic because loading `ActionMailer::Base` will cause it to
58
+ # read the config settings; this is the only time the config is read.
59
+ # If the config is loaded now, any settings declared in a config block
60
+ # in an initializer will be ignored.
57
61
#
58
- # This string version check avoids loading the ActionMailer class, as
59
- # would happen using `defined?`. This is necessary because the
60
- # ActionMailer class only loads it's settings once, at load time. If we
61
- # load the class now any settings declared in a config block in an
62
- # initializer will be ignored.
63
- #
64
- # We cannot use `config.action_mailer.respond_to?(:preview_path)` here
65
- # as it will always return `true`.
62
+ # If the action mailer railtie has not been loaded then `config` will
63
+ # not respond to the method. However, we cannot use
64
+ # `config.action_mailer.respond_to?(:preview_path)` here as it will
65
+ # always return `true`.
66
66
config . respond_to? ( :action_mailer ) && ::Rails ::VERSION ::STRING > '4.1'
67
67
end
68
68
end
You can’t perform that action at this time.
0 commit comments