RubyLLM 1.9.1: Rails Namespaces, Vertex AI Auth & Anthropic Uploads 🛤️🔐
A focused patch release that keeps ActiveRecord integrations humming in namespaced apps, restores Anthropic uploads, and hardens Vertex AI auth while smoothing out MySQL migrations and attachment handling.
🧭 Namespaced ActiveRecord Chats Keep Their Foreign Keys
acts_as_* helpers now accept explicit foreign key overrides, matching Rails’ association API, so namespaced chats and tool calls work even when their FK column doesn’t follow the default pattern.
class Support::Message < ActiveRecord::Base
acts_as_message chat_class: "Support::Conversation",
chat_foreign_key: "conversation_id",
tool_call_class: "Support::ToolCall",
tool_calls_foreign_key: "support_tool_call_id"
end- Fixes the regression introduced in 1.8.x for engines and modularized apps.
- Generators include the right foreign keys out of the box when you opt into namespaces.
🚆 Zeitwerk Eager Loading Behaves Outside Rails
The Railtie is now safely ignored during eager loading when Rails::Railtie isn’t defined, preventing NameError crashes in gems and background workers that depend on RubyLLM but don’t run inside Rails.
📎 Attachments Understand Uploaded Files
RubyLLM::Attachment detects ActionDispatch::Http::UploadedFile, Pathname, and Active Storage blobs automatically, preserving filenames and content types so file flows stay intact across providers.
attachment = RubyLLM::Attachment.new(params[:file])
attachment.filename # => original upload name- Normalizes MIME detection and rewinds IO sources for consistent encoding.
- Anthropic uploads once again serialize local PDFs/images correctly after the 1.9.0 regression fix.
🔐 Vertex AI Auth Uses googleauth the Right Way
Swapped fetch_access_token! for apply when building Vertex AI headers, keeping compatibility with recent googleauth releases and avoiding token caching errors.
🗄️ MySQL JSON Columns Skip Illegal Defaults
Rails generators detect MySQL adapters and omit default values for JSON columns, eliminating migration errors on Aurora/MySQL deployments.
🧪 Reliability Tweaks
Fresh specs cover RubyLLM::Utils coercion helpers so nested hashes and key transforms stay stable as we expand provider support.
Installation
gem "ruby_llm", "1.9.1"Upgrading from 1.9.0
bundle update ruby_llmMerged PRs
- fix(#403): Don't specify default values on mysql json by @UnderpantsGnome in #491
- Use apply instead of fetch_access_token for GAuth on vertex AI by @eddietokens in #492
- Refactor Attachment#initialize to extract source handling methods by @pekopekopekopayo in #487
- Fix Zeitwerk eager loading for railtie.rb by @trevorturk in #486
- Add specs for RubyLLM utils by @afurm in #494
- Fix namespaced models foreign key by @andreaslillebo in #460
New Contributors
- @UnderpantsGnome made their first contribution in #491
- @eddietokens made their first contribution in #492
- @pekopekopekopayo made their first contribution in #487
- @trevorturk made their first contribution in #486
- @afurm made their first contribution in #494
- @andreaslillebo made their first contribution in #460
Full Changelog: 1.9.0...1.9.1