From 555c1a3a5400dc257cee2ae5e209354f2dc4df8a Mon Sep 17 00:00:00 2001 From: Eileen Uchitelle Date: Fri, 21 Dec 2018 12:13:18 -0500 Subject: Fix app boot for Ruby 2.4 I have a test app that was on Ruby 2.4. When I pulled Rails master the app no longer would boot because of this change and I saw the following error: ``` SyntaxError: /Users/eileencodes/open_source/real_rails/railties/lib/rails/all.rb:18: syntax error, unexpected keyword_rescue, expecting keyword_end rescue LoadError ^ ``` Ruby 2.4 doesn't support removing redundant begins so the real issue is that this app is on Ruby 2.4 and not on Ruby 2.5. But it's super confusing for a user to understand the reason the app is failing to boot is because we need Ruby 2.5. I added this redundant begin back because we need to give a clearer error message. --- railties/lib/rails/all.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/all.rb b/railties/lib/rails/all.rb index b4a9c4e65f..7f4c625b39 100644 --- a/railties/lib/rails/all.rb +++ b/railties/lib/rails/all.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +# rubocop:disable Style/RedundantBegin + require "rails" %w( @@ -13,6 +15,8 @@ require "rails" rails/test_unit/railtie sprockets/railtie ).each do |railtie| - require railtie -rescue LoadError + begin + require railtie + rescue LoadError + end end -- cgit v1.2.3