Similar to this question except I don't use html_safe anywhere in the whole project.
I generate a CSV file in index.csv.erb like this:
<%=
response.content_type = 'application/octet-stream'
CSV.generate do |csv|
@persons.each do |person|
csv << [ person[:name], person[:nickname] ]
end
end
%>
PROBLEM: If nickname is NULL in the database (ActiveRecord/MySQL) then the CSV file associated element becomes "". I would expect "", or even nothing at all.
Result file sample:
Nicolas, Nico
Joe, ""
How can I prevent this from happening?