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?)

- ff

Posted via http://www.ruby-forum.com/.

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedDec 29, '11 at 6:45a
activeDec 29, '11 at 6:45a

1 user in discussion

Fearless Fool: 1 post



site design / logo © 2022 Grokbase