improve some code

This commit is contained in:
Sen-Zhang 2016-03-11 16:59:06 -08:00
parent 0b3ae023d2
commit 1be9563625
1 changed files with 4 additions and 2 deletions

View File

@ -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