mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #36582 from f1337/master
[skip ci] use 'template' instead of 'create_file' for erb templates in generators guide
This commit is contained in:
commit
60e19c6d6c
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
create_file "app/helpers/#{file_name}_helper.rb", <<-FILE
|
||||
template "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
|
||||
create_file "app/helpers/#{file_name}_helper.rb", <<-FILE
|
||||
template "app/helpers/#{file_name}_helper.rb", <<-FILE
|
||||
module #{class_name}Helper
|
||||
attr_reader :#{plural_name}, :#{plural_name.singularize}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue