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::DEFAULT_SESSION, BaseTool::MAX_SESSIONS, BaseTool::MAX_SESSION_ID_LENGTH, BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE
Class Method Summary collapse
Methods inherited from BaseTool
abstract!, abstract?, api_only_app?, api_only_note, cache_key, cached_context, config, current_session, #dedupe_put_patch_routes, detail_param?, error_response, evict_oldest_sessions, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, guide_row, inherited, introspection_warnings_note, invalid_detail_note, normalize_detail, not_found_response, paginate, rails_app, rails_env_name, registered_tools, reset_all_caches!, reset_cache!, session_from, session_params, session_queries, session_record, session_reset!, static_tier_banner, static_tier_refusal, text_response, touch_session, unavailable_note, with_session, with_session_for
Methods included from SectionFetch
Class Method Details
.call(model: nil, detail: "standard", server_context: nil) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/rails_ai_context/tools/get_callbacks.rb', line 60 def self.call(model: nil, detail: "standard", server_context: nil) fetch_section(:models, subject: "Model introspection") do |models| # 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 end |