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:
20
app/helpers/whetrails/models_helper.rb
Normal file
20
app/helpers/whetrails/models_helper.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
module Whetrails
|
||||
module ModelsHelper
|
||||
def vscode_uri(file, line)
|
||||
"vscode://file/#{file}:#{line}" if file
|
||||
end
|
||||
|
||||
def short_path(file)
|
||||
return nil unless file
|
||||
file.sub("#{::Rails.root}/", "")
|
||||
end
|
||||
|
||||
def condition_label(c)
|
||||
c.is_a?(Symbol) ? ":#{c}" : "<proc>"
|
||||
end
|
||||
|
||||
def validator_type_label(type)
|
||||
type.split("::").last.sub("Validator", "").downcase
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user