Add Rails engine with browser UI at /whetrails
Mounts a Rails engine that lists app models in a sidebar and renders the full callback/validator chain for any model. Source locations are linked via vscode:// URIs. Condition badges and concern module tags distinguish at-a-glance where each callback comes from. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
require_relative "whetrails/version"
|
||||
require_relative "whetrails/chain"
|
||||
require_relative "whetrails/inspector"
|
||||
require_relative "whetrails/engine" if defined?(Rails)
|
||||
|
||||
module Whetrails
|
||||
def self.inspect_model(model_class)
|
||||
|
||||
9
lib/whetrails/engine.rb
Normal file
9
lib/whetrails/engine.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
module Whetrails
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace Whetrails
|
||||
|
||||
# In the gem's dev setup, config/routes.rb belongs to the host app.
|
||||
# Point the engine's routing path to a dedicated file.
|
||||
config.paths.add "config/routes.rb", with: "lib/whetrails/engine_routes.rb"
|
||||
end
|
||||
end
|
||||
4
lib/whetrails/engine_routes.rb
Normal file
4
lib/whetrails/engine_routes.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
Whetrails::Engine.routes.draw do
|
||||
resources :models, only: [:index, :show]
|
||||
root to: "models#index"
|
||||
end
|
||||
Reference in New Issue
Block a user