*Et voilĂ !:*
# Output results dataset to CSV file
CSV.open("output.csv", "wb") do |csv|
results.each do |row|
csv << row.values.to_a
end
end
On Monday, May 15, 2017 at 9:17:44 AM UTC-4, Mark Cyzyk wrote:
>
>
> Thanks, Jeremy. I really appreciate your advice. Will try that stock CSV
> library.
>
> Mark
>
>
> On Monday, May 15, 2017 at 12:16:18 AM UTC-4, Jeremy Evans wrote:
>>
>> On Sunday, May 14, 2017 at 4:26:18 PM UTC-7, Mark Cyzyk wrote:
>>>
>>> Nice! Thanks.
>>>
>>> In that case, I'm thinking this should work?:
>>>
>>> DBLookupAndResults[:results].plugin :csv_serializer
>>> File.open('output.csv', 'w'){|file|
>>> file << results.to_csv
>>> }
>>>
>>
>> No, that shouldn't work, for multiple reasons. The most obvious is
>> results is not a local variable, so it would be interpreted as a method
>> call, and likely result in a NoMethodError. However, even before that, you
>> are likely to get a NoMethodError from the plugin call, unless
>> DBLookupAndResults[:results] returns a model class, which seems unlikely.
>>
>> Let me slightly tweak my previous advice. You should probably use the csv
>> library directly, or a helper like enum_csv if you want to convert a
>> dataset to csv.
>>
>> Thanks,
>> Jeremy
>>
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.