When we first moved excel generation off to a delayed job on survey-web, we had code that looked like this:
And this would bomb with an error like
Can't dump anonymous Module.
After some time getting nowhere, we solved it like this:
And in the job:
While refactoring a lot of that code over the last few days, we ran into the same issue. But with one difference. A controller spec was failing, but a test for the job which also passed a bunch of responses into it passed.
We wondered if maybe it was because we were passing a relation into the job instead of an array.
So we tried:
And that worked great.