Skip to content

Commit c5838ca

Browse files
committed
simplify RailsBooter no need to account for old Rails
1 parent e0629a3 commit c5838ca

File tree

2 files changed

+14
-46
lines changed

2 files changed

+14
-46
lines changed

src/main/ruby/jruby/rack/rails/environment.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/main/ruby/jruby/rack/rails_booter.rb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,22 @@ def boot!
2626
super
2727
ENV['RAILS_ROOT'] = app_path
2828
ENV['RAILS_ENV'] = rails_env
29+
self
30+
end
2931

30-
require 'jruby/rack/rails/environment'
31-
extend RailsEnvironment
32+
# @return [Rails::Application] the (loaded) application instance
33+
def to_app
34+
# backward "compatibility" calling #to_app without a #load_environment
35+
load_environment
36+
::Rails.application
37+
end
3238

33-
set_public_root
34-
self
39+
# Loads the Rails environment (*config/environment.rb*).
40+
def load_environment
41+
require expand_path('config/boot.rb')
42+
require 'jruby/rack/rails/railtie'
43+
require expand_path('config/environment.rb')
44+
require 'jruby/rack/rails/extensions'
3545
end
3646

3747
protected
@@ -42,12 +52,6 @@ def set_relative_url_root
4252
end
4353
end
4454

45-
# @see JRuby::Rack::RailsBooter::Rails2Environment#set_public_root
46-
# @see JRuby::Rack::RailsBooter::Rails3Environment#set_public_root
47-
def set_public_root
48-
# no-op by default - leave as it is
49-
end
50-
5155
# @deprecated no longer used, replaced with {#run_boot_hooks}
5256
def load_extensions
5357
# no-op

0 commit comments

Comments
 (0)