From 0b3ae023d27197417541932632055cd6be4810c4 Mon Sep 17 00:00:00 2001 From: Sen-Zhang Date: Fri, 11 Mar 2016 16:43:37 -0800 Subject: generate application_mailer.rb if it is missing --- actionmailer/lib/rails/generators/mailer/mailer_generator.rb | 4 ++++ .../lib/rails/generators/mailer/templates/application_mailer.rb | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb (limited to 'actionmailer/lib/rails/generators/mailer') diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb index ae5757917e..0277ecde16 100644 --- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb @@ -9,6 +9,10 @@ module Rails def create_mailer_file template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}_mailer.rb") + + unless File.exist?('app/mailers/application_mailer.rb') + template 'application_mailer.rb', 'app/mailers/application_mailer.rb' + end 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..02e8d3e454 --- /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 -- cgit v1.2.3