I'm cleaning up how I use Delayed::Job in my app. It's processing an
ActiveRecord as a delayed task. If the task ends with an error, I'd
*like* to set myActiveRecord.errors[:base] << 'error message'. The only
twist is that errors will be caught in the delayed task's thread.
My early experiments suggest that this won't work, at least not in the
obvious way: when I look at myActiveRecord.errors in the primary thread,
it appears empty, even though it was set in the delayed task's thread.
Is there a way to get the error to turn up in the primary thread?
(As a guess: I'm guessing no, because the in-memory copy of
myActiveRecord in the delayed task's thread is not the same in-memory
copy of myActiveRecord in the primary thread. The only way to get the
error message to turn up in both threads is to make it a field in the
my_active_records tables. Yes?)