提交 41503f3d 编写于 作者: R Ryuta Kamizono

Revert "Merge pull request #36582 from f1337/master"

This reverts commit 60e19c6d, reversing
changes made to 72e257b4.

The method signature is different between `create_file` and `template`.

https://www.rubydoc.info/github/erikhuda/thor/master/Thor/Actions#create_file-instance_method
https://www.rubydoc.info/github/erikhuda/thor/master/Thor/Actions#template-instance_method
上级 60e19c6d
......@@ -252,7 +252,7 @@ Add the method below, so our generator looks like the following:
# lib/generators/rails/my_helper/my_helper_generator.rb
class Rails::MyHelperGenerator < Rails::Generators::NamedBase
def create_helper_file
template "app/helpers/#{file_name}_helper.rb", <<-FILE
create_file "app/helpers/#{file_name}_helper.rb", <<-FILE
module #{class_name}Helper
attr_reader :#{plural_name}, :#{plural_name.singularize}
end
......@@ -307,7 +307,7 @@ To do that, we can change the generator this way:
# lib/generators/rails/my_helper/my_helper_generator.rb
class Rails::MyHelperGenerator < Rails::Generators::NamedBase
def create_helper_file
template "app/helpers/#{file_name}_helper.rb", <<-FILE
create_file "app/helpers/#{file_name}_helper.rb", <<-FILE
module #{class_name}Helper
attr_reader :#{plural_name}, :#{plural_name.singularize}
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册