Rails 4.2, active_jobs, callback_methods
In the method for completing a user task, I created a new record (and uploaded the file to S3). How can I pass or receive this new post id in the after_perform callback? I want to send an after_perform email with a link to an S3 document ... but I don't know how to get the identifier inside the after_perform method. According to the docs, you can use job.attributes, but I get the attributes of the undefined method.
I could move the mail program call to the execution method, but Id rather handled it correctly using callbacks. I'm not sure how to access attributes (or where these attributes come from) outside the execution method.
I tried to do some kind of detective work (to determine which attributes were available for a callback) by putting this in a callback:
puts "job: #{ job }"
or
puts "job: #{ job.attributes }"
or
puts "job: #{ job.attributes.first }"
none of them worked, and all of them led to undefined attributes.
source share