Skip to content

Resolve models by configured table name - #113

Open
nertzy wants to merge 1 commit into
with-model-test-unit-harnessfrom
resolve-configured-table-name-rdy
Open

Resolve models by configured table name#113
nertzy wants to merge 1 commit into
with-model-test-unit-harnessfrom
resolve-configured-table-name-rdy

Conversation

@nertzy

@nertzy nertzy commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • resolve loaded Active Record models by their configured table_name and connection pool
  • preserve raw SQL extraction when no usable model exists, including id-less tables
  • fail before writing fixtures when multiple unrelated models match one table
  • cover relocated models, autoloaded models, STI, abstract ancestors, connection pools, schema errors, and custom serialization

Why

Fixture generation currently infers model constants from conventional table names. Rails applications can move a model to a different table with self.table_name, and those tables silently fall back to raw SQL. The fallback bypasses model-backed serialization and can emit database-native values instead of the fixture values Rails expects.

@nertzy nertzy changed the title resolve configured table name rdy Resolve models by configured table name Sep 5, 2026
@nertzy
nertzy force-pushed the resolve-configured-table-name-rdy branch from 3282a12 to 4f487c8 Compare September 5, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant