Class: Konmari::Routes::RailsReloader
- Inherits:
-
Object
- Object
- Konmari::Routes::RailsReloader
- Defined in:
- lib/konmari/routes/rails_reloader.rb
Overview
When using Rails, any changes to config/routes.rb are detected by the server when developing and automatically reloaded.
In order to mimic this behavior, add RailsReloader as middleware in your development.rb file:
Rails.application.configure do
config.middleware.use Konmari::Routes::RailsReloader
...
end
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RailsReloader
constructor
A new instance of RailsReloader.
Constructor Details
#initialize(app) ⇒ RailsReloader
Returns a new instance of RailsReloader.
14 15 16 |
# File 'lib/konmari/routes/rails_reloader.rb', line 14 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 |
# File 'lib/konmari/routes/rails_reloader.rb', line 18 def call(env) routes_reloader.execute_if_updated return *@app.call(env) end |