-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/cascade destroy #1734
Fix/cascade destroy #1734
Conversation
This is needed to make polymorphic resources work
I'm not to happy with having to have the before_batch there. But I didn't now how to do it without it. |
Alright, so, I think we need to have both the old behavior and the new behavior as options. There are two reasons:
|
Sounds good, one more thing though. I stumbled upon this not because of a foreign key error but because it would hit this line
|
Ohhhhh right. So the right answer here is also a bit frustrating to implement probably. If the action is a destroy action, we should try to do it without loading data actually. What that looks like is:
Otherwise for destroy actions they must use the new before_batch behavior. |
I think that is pretty much what it is doing, isn't it? So in the error case we just need to check if we are in the after_action part of a a destroy action and if so return an error? |
lol. Yep, sorry. Was early when I was first responding, hadn't had my coffee yet. So I think the only thing needed here is to make this behavior opt-out, but opting out would raise an error if it gets to that error case and is an after action as you mentioned. |
Ready to go? |
🚀 Thank you for your contribution! 🚀 |
fixes the test in ash-project/ash_postgres#466