require 'fastercsv'

FasterCSV.parse(my_string, :headers => true) do |row|
  Fruit.create!(
    :name => row['name'],
    :color => row['color'],
    :tasty => row['tasty'] == 'true',
    :qty => row['qty].to_i
  )
end

For Ruby 1.9, just rename FasterCSV to CSV and fastercsv to csv:

require 'csv'

CSV.parse(my_string, :headers => true) do |row|
  # same as ruby-1.8
end


 so you must need fastercsv gem if you install then it is possible

 bye

-- 
Posted via http://www.ruby-forum.com/.