我目前正在使用此代码:
CSV.open "application.csv", "a+" do |csv|
csv << [ "#{params[:first_name]}", "#{params[:last_name]}","#{params[:company]}","#{params[:email]}", "#{params[:phone]}", "#{params[:business]}", "#{params[:services]}", "#{params[:employees]}", "#{params[:turnover]}" ]
end
每次都会向 csv 写入一个额外的行,我可以放什么而不是"a+"
每次都会覆盖整个文件,所以它总是只有一行?