diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2016-12-10 09:21:28 +0900 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-12-09 16:21:28 -0800 |
commit | c16296c79556ac660a0d7bd2df95e348a9e8df31 (patch) | |
tree | dfe31f94143cca9dac1b20d065a61f2f81bde73c | |
parent | ecddc0468d6cacd06faaa474d11f96f41b17ac78 (diff) | |
download | rails-c16296c79556ac660a0d7bd2df95e348a9e8df31.tar.gz rails-c16296c79556ac660a0d7bd2df95e348a9e8df31.tar.bz2 rails-c16296c79556ac660a0d7bd2df95e348a9e8df31.zip |
gemfile entry method need to return an empty array rather than nil (#27318)
This fixes the following error when executing rails new command.
```
(erb):9:in `block in template': undefined method `comment' for nil:NilClass (NoMethodError)
```
Follow up to #27288
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 187f4555a2..578aa23513 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -320,10 +320,10 @@ module Rails end def webpacker_gemfile_entry - if options[:webpack] - comment = "Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker" - GemfileEntry.github "webpacker", "rails/webpacker", nil, comment - end + return [] unless options[:webpack] + + comment = "Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker" + GemfileEntry.github "webpacker", "rails/webpacker", nil, comment end def jbuilder_gemfile_entry |