You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a validation function I run as a BeforeUpdateHook on one model. It runs some checks an associated model (in the context of the local model), and it would improve code flow if I could rely on
Local.SetForeign(_, _, foreignObject)
rather than setting the foreign ID and calling local.Update.
I'd love to take a stab at this if you don't have any objections to it.
The text was updated successfully, but these errors were encountered:
You're saying you would like SetForeign to actually make a call to the database? I was fairly certain that that already occurs. Though I think I'm not understanding exactly what you're bringing up here.
Ah yes. I now understand. That's a very good point that hooks are not run for these special operations. It makes sense to do that.
It also makes sense at some point to be able to opt out of hooks and timestamps by using a context value. This is of course a separate change but I wanted to mention it because I've only just now thought of it seeing as we're adding hooks in places people might not expect (or at least is a change from what's happening now)
I have a validation function I run as a
BeforeUpdateHook
on one model. It runs some checks an associated model (in the context of the local model), and it would improve code flow if I could rely onLocal.SetForeign(_, _, foreignObject)
rather than setting the foreign ID and calling
local.Update
.I'd love to take a stab at this if you don't have any objections to it.
The text was updated successfully, but these errors were encountered: