mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't use a class_attribute for ActionMailer::Base.preview_path
Since preview_path is read from ActionMailer::Base when previewing, subclasses can’t change it so don’t there's no need for the extra overhead imposed by using it.
This commit is contained in:
parent
35fd81672e
commit
7d86352f83
2 changed files with 3 additions and 7 deletions
|
@ -9,7 +9,7 @@ module ActionMailer
|
|||
#
|
||||
# config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
|
||||
#
|
||||
class_attribute :preview_path, instance_writer: false
|
||||
mattr_accessor :preview_path, instance_writer: false
|
||||
|
||||
# :nodoc:
|
||||
mattr_accessor :preview_interceptors, instance_writer: false
|
||||
|
@ -85,7 +85,7 @@ module ActionMailer
|
|||
|
||||
protected
|
||||
def load_previews #:nodoc:
|
||||
if preview_path?
|
||||
if preview_path
|
||||
Dir["#{preview_path}/**/*_preview.rb"].each{ |file| require_dependency file }
|
||||
end
|
||||
end
|
||||
|
@ -94,10 +94,6 @@ module ActionMailer
|
|||
Base.preview_path
|
||||
end
|
||||
|
||||
def preview_path? #:nodoc:
|
||||
Base.preview_path?
|
||||
end
|
||||
|
||||
def inform_preview_interceptors(message) #:nodoc:
|
||||
Base.preview_interceptors.each do |interceptor|
|
||||
interceptor.previewing_email(message)
|
||||
|
|
|
@ -46,7 +46,7 @@ module ActionMailer
|
|||
end
|
||||
|
||||
config.after_initialize do
|
||||
if ActionMailer::Base.preview_path?
|
||||
if ActionMailer::Base.preview_path
|
||||
ActiveSupport::Dependencies.autoload_paths << ActionMailer::Base.preview_path
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue