aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2018-12-21 12:13:18 -0500
committerEileen Uchitelle <eileencodes@gmail.com>2018-12-21 12:24:40 -0500
commit555c1a3a5400dc257cee2ae5e209354f2dc4df8a (patch)
tree36e984c9bb6cdc1d6084c08de790f27d29acd0dd /railties
parentb00e46bd6d399d3b8c4707ede0716c3ec2c39eb7 (diff)
downloadrails-555c1a3a5400dc257cee2ae5e209354f2dc4df8a.tar.gz
rails-555c1a3a5400dc257cee2ae5e209354f2dc4df8a.tar.bz2
rails-555c1a3a5400dc257cee2ae5e209354f2dc4df8a.zip
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.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/all.rb8
1 files 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