diff options
author | Koichi ITO <koic.ito@gmail.com> | 2018-03-01 19:47:29 +0900 |
---|---|---|
committer | Koichi ITO <koic.ito@gmail.com> | 2018-03-05 18:49:45 +0900 |
commit | e8be4f0891959afa1d6ca4510d1f9eb8e2887eb8 (patch) | |
tree | 45482949f3521fac7558f2a5d9045ed0891f12aa /railties/lib/rails/commands/version/version_command.rb | |
parent | e137831726c20b50fd0b1b280f17d3fdf338c690 (diff) | |
download | rails-e8be4f0891959afa1d6ca4510d1f9eb8e2887eb8.tar.gz rails-e8be4f0891959afa1d6ca4510d1f9eb8e2887eb8.tar.bz2 rails-e8be4f0891959afa1d6ca4510d1f9eb8e2887eb8.zip |
Deprecate safe_level of `ERB.new` in Ruby 2.6
### Summary
In a Rails application using Ruby 2.6.0-dev, when running `bin/rails g migration`
with `RUBYOPT=-w`, an ERB deprecation warnings will be displayed.
```console
% ruby -v
ruby 2.6.0dev (2018-03-03 trunk 62644) [x86_64-darwin17]
% bin/rails -v
Rails 6.0.0.alpha
% RUBYOPT=-w bin/rails g migration create_foos
(snip)
/Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66:
warning: Passing safe_level with the 2nd argument of ERB.new is
deprecated. Do not use it, and specify other arguments as keyword
arguments.
/Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66:
warning: Passing trim_mode with the 3rd argument of ERB.new is
deprecated. Use keyword argument like ERB.new(str, trim_mode: ...)
instead.
/Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66:
warning: Passing eoutvar with the 4th argument of ERB.new is
deprecated. Use keyword argument like ERB.new(str, eoutvar: ...)
instead.
create db/migrate/20180304002144_create_foos.rb
```
This PR suppresses the above deprecation warnings in Ruby 2.6.0-dev.
This warning is due to the interface of `ERB.new` will change from Ruby 2.6.
> Add :trim_mode and :eoutvar keyword arguments to ERB.new.
> Now non-keyword arguments other than first one are softly deprecated
> and will be removed when Ruby 2.5 becomes EOL. [Feature #14256]
https://github.com/ruby/ruby/blob/2311087b685e8dc0f21f4a89875f25c22f5c39a9/NEWS#stdlib-updates-outstanding-ones-only
The following addresses are related Ruby's commit.
https://github.com/ruby/ruby/commit/cc777d0
Also this PR will change `ERB.new` used in `tasks/release.rb`.
### Other Information
This PR uses `ERB.version` to switch `ERB.new` interface. Because Rails 6
supports multiple Ruby versions (Ruby 2.4.1 or higher), it need to
use the appropriate interface.
Using `ERB.version` instead of `RUBY_VERSON` is based on the following patch.
https://github.com/ruby/ruby/pull/1826
This patch is built into Ruby.
https://github.com/ruby/ruby/commit/40db89c0934c23d7464d47946bb682b9035411f9
Diffstat (limited to 'railties/lib/rails/commands/version/version_command.rb')
0 files changed, 0 insertions, 0 deletions