On 23 Sep 2005, at 08:49, Mohammad Khan wrote:

> My piece of code is below, (consider Country is subclass  
> ActiveReocrd::Base)
>
> File.open("country.list").each do | line |
> line.strip!
> name, code = line.split("\t")
>
> c = Country.new
> c.name <http://c.name> = name
> c.code = code
> c.save
> end
>
> This piece of code is inserting rows in countries table.
> and the number of insert statement is equal to the number of lines in
> country.list
>
> Is there any way to save those rows by one method.
> What I want is not to send 100 insert statement to database server,  
> I want
> to send only one insert statement in database server.

http://lists.rubyonrails.org/mailman/listinfo/rails

Has your answer.

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04