Class: CompletionKit::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- CompletionKit::Engine
- Defined in:
- lib/completion_kit/engine.rb
Constant Summary collapse
- ROUTES_WARMUP_LOCK =
Mutex.new
Class Method Summary collapse
- .register_assets(app) ⇒ Object
-
.warm_routes! ⇒ Object
Materialise the engine’s lazy route set once, single-threaded.
Class Method Details
.register_assets(app) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/completion_kit/engine.rb', line 25 def self.register_assets(app) app.config.assets.precompile += %w( completion_kit/application.css completion_kit/application.js completion_kit/logo.png completion_kit/favicon.ico ) end |
.warm_routes! ⇒ Object
Materialise the engine’s lazy route set once, single-threaded. Background worker threads that render engine partials for Turbo broadcasts otherwise race the lazy first-load and raise “undefined method ‘run_response_path’” (production survives only because eager_load finalises routes at boot).
17 18 19 20 21 22 23 |
# File 'lib/completion_kit/engine.rb', line 17 def self.warm_routes! ROUTES_WARMUP_LOCK.synchronize do return if @routes_warmed routes.url_helpers.root_path @routes_warmed = true end end |