Skip to content

Resolve Active Record models by their configured table name #109

Description

@nertzy

FixtureBuilder currently infers a model class from each table name with table_name.classify.constantize. This assumes the class name and table name follow Active Record conventions.

Models that use self.table_name = are not recognized when the configured table name cannot be constantized. FixtureBuilder then uses its model-less SQL extraction path instead of the model-backed path. This bypasses model-specific behavior such as custom Active Record type serialization.

Model discovery should honor each Active Record model's configured table_name while preserving the existing fallback for tables that genuinely have no model.

Acceptance criteria

  • A model whose configured table name does not correspond to its class name is extracted through the model-backed path.
  • Conventionally named models continue to work.
  • Tables without an Active Record model continue to use the raw SQL fallback.
  • Regression coverage distinguishes model-backed extraction from raw SQL extraction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions