aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-03-06 10:09:07 +0100
committerXavier Noria <fxn@hashref.com>2016-03-06 10:09:07 +0100
commitfbf3411b11762db4bf80dc8695863e623515c701 (patch)
tree6c19c8174ad0f4b46297b0e1e5f9731616371a91 /railties
parent69371b0d9d2f817468ca69005868724885c2ebe5 (diff)
downloadrails-fbf3411b11762db4bf80dc8695863e623515c701.tar.gz
rails-fbf3411b11762db4bf80dc8695863e623515c701.tar.bz2
rails-fbf3411b11762db4bf80dc8695863e623515c701.zip
prefer require_relative over require + File.expand_path
Reads much better doesn't it.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config.ru3
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environment.rb2
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/rails/application.rb2
4 files changed, 5 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/rails/generators/rails/app/templates/config.ru
index 9797be5aed..f7ba0b527b 100644
--- a/railties/lib/rails/generators/rails/app/templates/config.ru
+++ b/railties/lib/rails/generators/rails/app/templates/config.ru
@@ -1,4 +1,5 @@
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('config/environment', __dir__)
+require_relative 'config/environment'
+
run Rails.application
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb
index bd4e05fc90..c0a0bd0a3e 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -1,4 +1,4 @@
-require File.expand_path('boot', __dir__)
+require_relative 'boot'
<% if include_all_railties? -%>
require 'rails/all'
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environment.rb b/railties/lib/rails/generators/rails/app/templates/config/environment.rb
index 0b8bdd8289..426333bb46 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environment.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/environment.rb
@@ -1,5 +1,5 @@
# Load the Rails application.
-require File.expand_path('application', __dir__)
+require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
diff --git a/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb b/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
index bb683ab9cc..d71a021bd2 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
+++ b/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
@@ -1,4 +1,4 @@
-require File.expand_path('boot', __dir__)
+require_relative 'boot'
<% if include_all_railties? -%>
require 'rails/all'