diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-26 11:50:36 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-26 12:05:35 +0000 |
commit | 7d86352f83079458dd04df2ee5e1b38179c3aac3 (patch) | |
tree | 20ddc4a3b933bb29a072d9ab1f535e25ffb8a7ee /actionmailer/lib | |
parent | 35fd81672e02497c31f0b3cab965f4a38090229a (diff) | |
download | rails-7d86352f83079458dd04df2ee5e1b38179c3aac3.tar.gz rails-7d86352f83079458dd04df2ee5e1b38179c3aac3.tar.bz2 rails-7d86352f83079458dd04df2ee5e1b38179c3aac3.zip |
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.
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/preview.rb | 8 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/actionmailer/lib/action_mailer/preview.rb b/actionmailer/lib/action_mailer/preview.rb index 0efd702e4d..fde0e86f5b 100644 --- a/actionmailer/lib/action_mailer/preview.rb +++ b/actionmailer/lib/action_mailer/preview.rb @@ -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) diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index c893ddfef5..8d1e40297b 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -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 |