Hello James,
Thanks for the answer.

The code that you presented gave me some ideias, however I still don't 
know the best way to overcome some problems:
- What is the best way to convert a column to boolean values?
- The csv file can have a column that has both float and integer values 
in it. In this case I want to create a float column in the database.
- Is there a way to avoid the duplicating of information? The example 
you gave shows the same classes twice.

To better ilustrate the problems here is one sample:
data = <<-END
      string,number,boolean
      James,32,true
      Dana,33.21,false
END

Thanks again.
Best regards,
Migrate

James Gray wrote:
> On Jul 15, 2007, at 6:44 AM, Hu Ma wrote:
> 
>> Hello all,
> 
> Hello.
> 
>> Does anyone know how to do this?
> Does this give you any fresh ideas?
> 
>  >> require "faster_csv"
> => true
>  >> data = <<-END
> name,age
> James,31
> Dana,21
> END
> => "name,age\nJames,31\nDana,21\n"
>  >> FCSV.parse(data, :headers => true, :converters => :numeric) do |row|
> ?>   p row.inject({}) { |h, (k, v)| h.merge(k => v.class) }
>  >> end
> {"name"=>String, "age"=>Fixnum}
> {"name"=>String, "age"=>Fixnum}
> => nil
> 
> James Edward Gray II


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