Skip to content

Conversation

@acidjazz
Copy link
Member

@acidjazz acidjazz commented Sep 9, 2025

Summary

Enhanced the model binder's table name resolution to use proper English pluralization rules instead of simply appending "s" to model names.

Changes

  • Added findTableName() helper function with comprehensive pluralization rules
  • Updated table lookup logic in lookupModels() to try multiple variations in order
  • Replaced hardcoded ${modelName}s pattern with intelligent pluralization

Pluralization Rules Implemented

  • Sibilants (s, x, z, ch, sh) → add "es" (kisskisses)
  • Consonant + y → change "y" to "ies" (citycities)
  • Words ending in f → change "f" to "ves" (leafleaves)
  • Words ending in fe → change "fe" to "ves" (knifeknives)
  • Consonant + o → add "es" (heroheroes)
  • Standard pluralization → add "s" (userusers)
  • Original name fallback → no change (smssms)

@acidjazz acidjazz changed the title feat: Enhance model binder with intelligent pluralization for table name resolution feat: intelligent pluralization for table name resolution Sep 9, 2025
@acidjazz acidjazz linked an issue Sep 9, 2025 that may be closed by this pull request
@acidjazz acidjazz merged commit a5c0128 into main Sep 9, 2025
2 checks passed
@acidjazz acidjazz deleted the plurals branch September 9, 2025 07:15
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.

Model binder fails with improper pluralization for table name resolution

2 participants