I am having a code that runs a delayed job that generates a report and then sends in an email here :
InstancesExportJob.perform_later(instances: instances, custom_field_key: options[:custom_field_key],tag_columns: options[:tags],user: User.current,report_url: report_url)
where instances
is a generated active record query that is generated by another class this code fails and gives the following error: ActiveJob::SerializationError:Unsupported argument type: ActiveRecord::Relation
.
where the first operation that is done on instances
is a map
function call.
but changing the code to this makes it work fine:
InstancesExportJob.perform_later(instances: instances.to_a, custom_field_key: options[:custom_field_key],tag_columns: options[:tags],user: User.current,report_url: report_url)
.
I am confused as running the code without delayed jobs works fine.
Am using rails 4.2
and sidekiq
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…