Closed nynhex closed 7 years ago
The arguments to perform
are up to you. You can certainly pass current_user
as an arg, or perhaps the user_id
. I don't regularly use Devise, but I'm guessing you'd have to set user somehow to make it work properly. Hope this helps.
I'm using the latest sucker_punch and it works great. I have a simple worker that updates an attribute based off of a AR scoped array.
When I fire this job or schedule it, it performs fine, however because current_user (devise) is not available in the worker/job when the attribute is updated and my auditing module (audited) records the change, I get a user_id with a nil value.
Is there a way to fire off this job and somehow pass a User object as an argument so that audited will record user_id somehow?
Here's my very basic worker, and how I'm calling it (note I'm using the deprecated syntax which I wrote the initializer for)
And how I'm calling it from whenever or from the rails console:
If I need to move this to stack, that's fine but I didn't see anything in the wiki regarding this.