From 44494882ba97575df5a012d7a05a9f69d60cd050 Mon Sep 17 00:00:00 2001 From: Manuel Meurer Date: Thu, 9 Oct 2025 11:23:04 +0200 Subject: [PATCH] integrate with ruby_llm activerecord chat methods --- lib/ruby_llm/template/railtie.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/ruby_llm/template/railtie.rb b/lib/ruby_llm/template/railtie.rb index a64318b..85af9d5 100644 --- a/lib/ruby_llm/template/railtie.rb +++ b/lib/ruby_llm/template/railtie.rb @@ -14,6 +14,17 @@ class Railtie < Rails::Railtie config.template_directory ||= app.root.join("app", "prompts") end end + + initializer "ruby_llm_template.active_record" do + if defined?(RubyLLM::ActiveRecord::ChatMethods) + RubyLLM::ActiveRecord::ChatMethods.module_eval do + def with_template(...) + to_llm.with_template(...) + self + end + end + end + end end end end