aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorAndy Jeffries <andy@andyjeffries.co.uk>2014-11-17 10:44:04 +0000
committerAndy Jeffries <andy@andyjeffries.co.uk>2014-11-21 16:46:49 +0000
commit38cfaa828502b2f5d137a6a2952c68ae5efc15b1 (patch)
tree84a86084e875142b1b6309f646bc1a8ad508f3b0 /actionmailer
parent3a804aab9557efd1f1f3b68a5d1e9e3c2f37df20 (diff)
downloadrails-38cfaa828502b2f5d137a6a2952c68ae5efc15b1.tar.gz
rails-38cfaa828502b2f5d137a6a2952c68ae5efc15b1.tar.bz2
rails-38cfaa828502b2f5d137a6a2952c68ae5efc15b1.zip
Creates an ApplicationMailer and layout by default, including html and body tags to reduce spam score
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/rails/generators/mailer/mailer_generator.rb1
-rw-r--r--actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb4
-rw-r--r--actionmailer/lib/rails/generators/mailer/templates/mailer.rb3
3 files changed, 6 insertions, 2 deletions
diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
index d5bf864595..97a01f9ef3 100644
--- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
+++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
@@ -8,6 +8,7 @@ module Rails
def create_mailer_file
template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}.rb")
+ template "application_mailer.rb", File.join('app/mailers/application_mailer.rb')
end
hook_for :template_engine, :test_framework
diff --git a/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb b/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb
new file mode 100644
index 0000000000..d25d8892dd
--- /dev/null
+++ b/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: "from@example.com"
+ layout 'mailer'
+end
diff --git a/actionmailer/lib/rails/generators/mailer/templates/mailer.rb b/actionmailer/lib/rails/generators/mailer/templates/mailer.rb
index edcfb4233d..bce64a5e6e 100644
--- a/actionmailer/lib/rails/generators/mailer/templates/mailer.rb
+++ b/actionmailer/lib/rails/generators/mailer/templates/mailer.rb
@@ -1,6 +1,5 @@
<% module_namespacing do -%>
-class <%= class_name %> < ActionMailer::Base
- default from: "from@example.com"
+class <%= class_name %> < ApplicationMailer
<% actions.each do |action| -%>
# Subject can be set in your I18n file at config/locales/en.yml