Class: Findbug::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Findbug::Engine
- Defined in:
- lib/findbug/engine.rb
Overview
Engine is the main Rails integration point for Findbug.
WHAT IS A RAILS ENGINE?
An engine is like a mini Rails app that can be mounted inside another app. It has its own:
-
Controllers
-
Models
-
Views
-
Routes
-
Assets
But it shares the host app’s:
-
Database connection
-
Session
-
Application configuration
This is how gems like Sidekiq, Resque, and Devise provide web UIs.
MOUNTING THE ENGINE
The Railtie automatically mounts this engine at config.web_path (default “/findbug”).
Users can also manually mount:
# config/routes.rb
mount Findbug::Engine => "/my-findbug"
ISOLATION
We use ‘isolate_namespace` to prevent our routes/helpers from conflicting with the host app. All our routes are prefixed with `findbug_`.
Class Method Summary collapse
-
.root ⇒ Object
Set the root path for the engine to the gem’s root directory This tells Rails where to find app/controllers, app/models, app/views, etc.
Class Method Details
.root ⇒ Object
Set the root path for the engine to the gem’s root directory This tells Rails where to find app/controllers, app/models, app/views, etc.
62 63 64 |
# File 'lib/findbug/engine.rb', line 62 def self.root @root ||= Pathname.new(FINDBUG_GEM_ROOT) end |