Class: Konmari::Routes::RailsReloader

Inherits:
Object
  • Object
show all
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

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