Class: Tidewave::Tools::GetModels

Inherits:
Base
  • Object
show all
Defined in:
lib/tidewave/tools/get_models.rb

Instance Method Summary collapse

Methods inherited from Base

file_system_tool, file_system_tool?

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/tidewave/tools/get_models.rb', line 9

def call
  # Ensure all models are loaded
  Rails.application.eager_load!

  models = ActiveRecord::Base.descendants.map do |model|
    { name: model.name, relationships: get_relationships(model) }
  end

  models.to_json
end