Stefano Crocco
12/28/2007 7:06:00 PM
Alle venerd=C3=AC 28 dicembre 2007, Mark Toth ha scritto:
> I have this code:
>
> file =3D "filename.txt"
> File.open(file) do |sFile|
> while line =3D sFile.gets
> row =3D line.split("\t")
> a_product =3D Product.new(
>
> :sku =3D> row[0] ,
> :name =3D> row[1] ,
> :price =3D> row[2] ,
>
> a_product.save
> end
> end
>
> What if I want to jump over the first line of the file so it won=C2=B4t be
> imported?
>
> Thank you,
>
> Mark
A possibility is to do a call to sFile.gets before the while cycle. This wa=
y,=20
the first line of the file is read but not used.
Stefano