Generate model-aware fixtures for configured tables - #113
Open
nertzy wants to merge 1 commit into
Open
Conversation
This was referenced Sep 5, 2026
nertzy
force-pushed
the
resolve-configured-table-name-rdy
branch
from
September 5, 2026 01:30
3282a12 to
4f487c8
Compare
Document native metadata, model eligibility, and generated configuration output.
nertzy
force-pushed
the
resolve-configured-table-name-rdy
branch
from
September 7, 2026 00:55
4f487c8 to
83554cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixture generation infers model constants from conventional table names. Models with a configured
table_namecan therefore fall back to raw SQL, bypassing model-backed serialization. Generated fixture filenames also do not necessarily tell Rails which model to use when loading them.Extract model selection into
ModelResolver, retaining conventional autoloading while matching loaded models by their actual table and connection pool. Collapse STI descendants to their eligible root, retain SQL fallback for tables without a usable model, and raise on ambiguous independent models before replacing fixture YAML.Every model-backed fixture file now declares its resolved class through Rails’ native
_fixture.model_classmetadata, including conventionally named models. Rails can consume the generated files without a separate class map. Empty-file behavior still depends on actual rows, and the reserved_fixturerecord label is rejected rather than silently overwritten.The README describes Rails’ existing mapping precedence, native loading transformations, and raw-table limitations. This adds no eager-loading requirement, public mapping API, or custom mapping cache.