Class: RailsAiContext::Tools::GetCallbacks
- Defined in:
- lib/rails_ai_context/tools/get_callbacks.rb
Constant Summary collapse
- CALLBACK_EXECUTION_ORDER =
%w[ before_validation after_validation before_save around_save before_create around_create after_create before_update around_update after_update after_save before_destroy around_destroy after_destroy after_commit after_create_commit after_update_commit after_destroy_commit after_save_commit after_rollback after_touch after_find after_initialize ].freeze
Constants inherited from BaseTool
BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE
Class Method Summary collapse
Methods inherited from BaseTool
abstract!, abstract?, cache_key, cached_context, config, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, inherited, not_found_response, paginate, rails_app, registered_tools, reset_all_caches!, reset_cache!, session_queries, session_record, session_reset!, set_call_params, text_response
Class Method Details
.call(model: nil, detail: "standard", server_context: nil) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rails_ai_context/tools/get_callbacks.rb', line 53 def self.call(model: nil, detail: "standard", server_context: nil) models = cached_context[:models] return text_response("Model introspection not available. Add :models to introspectors.") unless models return text_response("Model introspection failed: #{models[:error]}") if models[:error] # Specific model — show callbacks in execution order if model key = fuzzy_find_key(models.keys, model) || model data = models[key] unless data return not_found_response("Model", model, models.keys.sort, recovery_tool: "Call rails_get_callbacks(detail:\"summary\") to see all models with callbacks") end return text_response("Error inspecting #{key}: #{data[:error]}") if data[:error] return text_response(format_model_callbacks(key, data, detail)) end # List all models with callbacks list_all_callbacks(models, detail) end |