Welcome to Rails :)

I understand you're only looking for help on loading the CSV-files
into the import table using Rails? I'm no expert on this, because I
only did this using PHP a long time ago, but hey, any help is help,
right?

Using fasterCSV you'll probably want to look at parsing the CSV file
line by line. So, for example, if you know every line has a name and a
value:

FasterCSV.foreach("path/to/file.csv") do |row|
  Import.new(:name => row[0], :value => row[1]).save
end

You can then use Rails to compare every instance of the import table
to your target table.

This might bring up some performance issues though, because you're
doing a MySQL INSERT query on every line. You can also look at
FasterCSV.read and get that array of arrays into your table some way
(I know MySQL can import an entire table within one query), but I'm
very tired and won't be of much help there at this moment ;)

Hope this helps!

Kind regards,
Jaap Haagmans
w. http://www.relywebsolutions.nl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to