Class: Machined::Middleware::RootIndex
- Inherits:
-
Object
- Object
- Machined::Middleware::RootIndex
- Defined in:
- lib/machined/middleware/root_index.rb
Overview
Sprockets >= 2.4.4 no longer infers that ‘/’ should equal ‘/index.html’, so this middleware changes the PATH_INFO if necessary.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RootIndex
constructor
A new instance of RootIndex.
Constructor Details
#initialize(app) ⇒ RootIndex
Returns a new instance of RootIndex.
8 9 10 |
# File 'lib/machined/middleware/root_index.rb', line 8 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 |
# File 'lib/machined/middleware/root_index.rb', line 12 def call(env) env['PATH_INFO'] = '/index.html' if env['PATH_INFO'] == '/' @app.call(env) end |