Skip to content

Commit cba3d1b

Browse files
committed
simplify RailsBooter no need to account for old Rails
1 parent 366d8d2 commit cba3d1b

File tree

2 files changed

+15
-43
lines changed

2 files changed

+15
-43
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: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,24 @@ def boot!
3030
require 'jruby/rack/rails/environment'
3131
extend RailsEnvironment
3232

33-
set_public_root
3433
self
3534
end
3635

36+
# @return [Rails::Application] the (loaded) application instance
37+
def to_app
38+
# backward "compatibility" calling #to_app without a #load_environment
39+
load_environment
40+
::Rails.application
41+
end
42+
43+
# Loads the Rails environment (*config/environment.rb*).
44+
def load_environment
45+
require expand_path('config/boot.rb')
46+
require 'jruby/rack/rails/railtie'
47+
require expand_path('config/environment.rb')
48+
require 'jruby/rack/rails/extensions'
49+
end
50+
3751
protected
3852

3953
def set_relative_url_root
@@ -42,12 +56,6 @@ def set_relative_url_root
4256
end
4357
end
4458

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-
5159
# @deprecated no longer used, replaced with {#run_boot_hooks}
5260
def load_extensions
5361
# no-op

0 commit comments

Comments
 (0)