mailer_generator.rb 461 字节
Newer Older
1 2 3 4 5
module Erb
  module Generators
    class MailerGenerator < Base
      argument :actions, :type => :array, :default => []

J
José Valim 已提交
6 7 8 9
      def create_view_folder
        empty_directory File.join("app", "views", file_path)
      end

10 11 12 13 14 15 16 17 18
      def create_view_files
        actions.each do |action|
          @action, @path = action, File.join(file_path, action)
          template "view.erb", File.join("app", "views", "#{@path}.erb")
        end
      end
    end
  end
end