aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/rails/generators/mailer
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/lib/rails/generators/mailer')
-rw-r--r--actionmailer/lib/rails/generators/mailer/mailer_generator.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
index 0277ecde16..f86d43be61 100644
--- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
+++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
@@ -10,8 +10,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'
+ in_root do
+ if self.behavior == :invoke && !File.exist?('app/mailers/application_mailer.rb')
+ template 'application_mailer.rb', 'app/mailers/application_mailer.rb'
+ end
end
end