diff options
Diffstat (limited to 'railties/lib/rails/generators/erb/mailer/mailer_generator.rb')
-rw-r--r-- | railties/lib/rails/generators/erb/mailer/mailer_generator.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb index 1e290bb938..f9b3658ae7 100644 --- a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb +++ b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb @@ -1,26 +1,27 @@ -require 'rails/generators/erb/controller/controller_generator' +require 'rails/generators/erb' module Erb # :nodoc: module Generators # :nodoc: - class MailerGenerator < ControllerGenerator # :nodoc: + class MailerGenerator < Base # :nodoc: + argument :actions, type: :array, default: [], banner: "method method" + def copy_view_files view_base_path = File.join("app/views", class_path, file_name) empty_directory view_base_path - layout_base_path = "app/views/layouts" + formats.each do |format| + layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format)) + template filename_with_extensions(:layout, format), layout_path + end actions.each do |action| @action = action formats.each do |format| - @view_path = File.join(view_base_path, filename_with_extensions(action, format)) - template filename_with_extensions(:view, format), @view_path - - @layout_path = File.join(layout_base_path, filename_with_extensions("mailer", format)) - template filename_with_extensions(:layout, format), @layout_path + @path = File.join(view_base_path, filename_with_extensions(action, format)) + template filename_with_extensions(:view, format), @path end end - end protected |