I have everything working fine except saving my changes to the field im updating:
require 'csv'
@parsed_file = CSV::Reader.parse(File.open("#{RAILS_ROOT}/doc/some.csv"))
@parsed_file.each_with_index do |row, x|
address = row[5]
l = Location.address_find(address)
if l != nil
puts "#{l.name} at #{l.address}"
row[14] = l.store_code
puts row[14]
else
puts "No matching address Found!!!"
end
#What do I do here? Something like this? CSV::Writer.generate(@parsed_file)
end
What do I do Here? how do I save the changes I made and update the file?