Class: Rails::Application::RoutesReloader

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/ext/freedom_patches/routes_reloader.rb

Instance Method Summary collapse

Instance Method Details

#executeObject

HACK: Adds a rescue to the method that eager loads routes. This rescue looks a the specific error the occurs when eager loading in development, and forces the routes to reload again, clearing out load paths and resetting everything – essentially like restarting the application. This allows us to avoid a constant need to stop and restart the server. Only included in development environments.



11
12
13
14
15
16
17
18
# File 'lib/workarea/ext/freedom_patches/routes_reloader.rb', line 11

def execute
  ret = updater.execute
  route_sets.each(&:eager_load!) if eager_load
  ret
rescue ArgumentError => e
  raise e unless e.message == "unknown firstpos: NilClass"
  reload!
end