Problem with hooks and association
See original GitHub issueI spent 2 hours to find how to make it works because seems to be broken
This don’t call my hook
Restaurants.hasMany(RestaurantPictures, {
as: "Pictures",
foreignKey: "restaurant",
onDelete: "CASCADE",
hooks: true
})
This call my hook
Restaurants.hasMany(RestaurantPictures, {
as: "Pictures",
foreignKey: "restaurant",
onDelete: "cascade",
hooks: true
})
can you please fix it ? (like do a string.toLowerCase())
thanks
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Problem with destroy hooks on n:m association #4777 - GitHub
Hi, I am having a weird behavior despite applying what the documentation says. I have 2 models and an n:m association via a...
Read more >React.useEffect Hook – Common Problems and How to Fix ...
We are checking if the hook is receiving a user object. After that, we are fetching a list of our users from a...
Read more >The Ugly side Of React Hooks | The Startup - Medium
Isn't it ironic? The biggest problem of React, in my opinion at least, is that it doesn't provide an out-of-the-box state management solution...
Read more >Rules of Hooks - React
Only Call Hooks at the Top Level ... Don't call Hooks inside loops, conditions, or nested functions. Instead, always use Hooks at the...
Read more >Avoiding common mistakes in React Hooks - LogRocket Blog
Even though React Hooks components have been around for a few years now, there are still some common mistakes that we can learn...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lomberas Use
foreignKey: 'user_id'
on both your hasMany and belongsTo relation so it matches what you have in the database.Tested, and the hooks is invoked for me regardless of the casing of cascade. If you still have issues, please open a PR with failing test case @gossel-j