Fix(crud) include param lookup now works w/plurals #26
Reference in New Issue
Block a user
Delete Branch "fix-include"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Previously, {one,many}-to-many relationships with models would result in
associationNamesthat were plural. e.g.Teammight have many playersand one location. The validation was expecting to see the plural
Playersand the singularLocationbut Sequelize is expecting thesingular
Player(Locationworked fine). This meant that include lookupswould silently fail. This fixes the problem in a backward- compatible way.
It continues to allow
include=Location(capitalized) for backward-compatibility. And now allows and actually does the lookup for
include=players,include=player,include=Player,include=Playerslookup relationships.
There are also a few small changes that enable the above.
I'm working on a separate PR that adds integration tests so that we can ensure this kind of thing doesn't happen again.
cc @mdibaiee
@joeybaker: Thanks Joey! Looks fine to me 👍
Released as 2.7.1