Ralph::SchemaMismatchError
Inherits Ralph::Error / Exception / Reference / Object
Raised when model columns don't match the ResultSet columns during hydration
This error catches mismatches between what a model expects and what the database actually returns. Common causes:
- Model is missing columns that exist in the database
- Model has extra columns not in the database
- Column order mismatch (when using SELECT * or wrong column order)
- Schema drift after database migrations
Example
# When loading a Supply record with mismatched schema:
Supply.find(id)
# => Ralph::SchemaMismatchError: ResultSet mismatch for Supply (table: supplies)
#
# Expected 16 columns, got 18 from database
#
# Missing in model (add these columns):
# - catalog_supply_id
# - tenant_catalog_supply_id
#
# First mismatch at index 0:
# Expected: id
# Got: created_at
#
# Hint: Run `ralph db:pull` to regenerate your model from the database schema,
# or manually add the missing columns to your model definition.
Constructors
Instance methods
actual_columns
Sourceexpected_columns
Sourcemodel_name
Sourcetable_name
Source