Provider generator guide documents a migration version the generator does not emit
Summary
docs/api/rails_provider_generator.md has a section headed "What Gets Generated (Detailed)" whose first entry shows the migration the provider generators produce. It declares:
class CreateMyBankTablesAndAccounts < ActiveRecord::Migration[7.2]Both generators derive that version from Rails at generation time, so on main today they emit [8.1]. The guide documents output the tool does not produce.
Evidence
Both generators compute it the same way:
# lib/generators/provider/family/family_generator.rb:870
# lib/generators/provider/global/global_generator.rb:181
def migration_version
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
endand both templates interpolate it rather than hardcoding a version:
# lib/generators/provider/family/templates/migration.rb.tt:3
class Create<%= class_name %>ItemsAndAccounts < ActiveRecord::Migration<%= migration_version %>main is on rails (8.1.3.1) (Gemfile.lock) and db/schema.rb declares ActiveRecord::Schema[8.1], so Rails::VERSION::MAJOR.MINOR is 8.1. Confirmed in a console on main:
Rails::VERSION::STRING = 8.1.3.1
generator would emit = [8.1]
ActiveRecord::Migration.current_version = 8.1The tree agrees. The most recent migration of exactly the shape this template produces is db/migrate/20260911165424_create_fio_items_and_accounts.rb, and it declares ActiveRecord::Migration[8.1] — so the generator is behaving correctly and only the guide is out of step.
Why it is worth fixing
The line sits under a heading that promises generated output, in a guide written for people adding a provider, inside a fenced block that reads as something to copy. AGENTS.md line 13 already states the rule:
New migrations use the current Rails migration version; leave historical migration versions intact.
So the guide contradicts both the documented rule and the tool it documents. A reader following it by hand — or checking generated output against it and "correcting" the generator to match — lands on a version the app left behind.
To be clear about what I am not claiming: migrations on main are currently mixed between [7.2] and [8.1], but I have not traced any of them to this guide and I am not asserting it caused them. The defect here is simply that the documentation is factually wrong about the generator's output.
Scope
One line. docs/api/rails_provider_generator.md:173, [7.2] → [8.1], plus a short note that the generator emits the current Rails version so the example is not "corrected" back later. No code, no schema, no behaviour change.
Related, non-overlapping
- #3620 (open) edits the same file, at the item-model section around lines 244–271. Different hunk, no textual overlap.
- #2546 and #3550 concern the generator's code; neither mentions migrations.
Source: we-promise/sure