On Friday, May 2, 2014 4:38:32 AM UTC-7, Oldřich Vetešník wrote:
>
> Hello Jeremy,
>
> As the subject says, is there a way to check if record was created xor
> updated in the after_commit hook?
> We've been using after_create but that introduced race conditions with
> background jobs.
> I saw there is a @was_new variable, which is true in the after_create but
> nil in after_commit.
> Right now I've come up with a workaround:
>
You should do use the model's after_create hook with the databases's
after_commit:
def after_create
super
db.after_commit{notify}
end
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.