views:

29

answers:

1

Take it as example.

new_array = []

Country.all do |c|
  g = c
  c = c.clone
  c.country_name = "kkk"
  new_array << c
end

At this point my new_array containing multiple records .. How may i store all the values with one save or create ? Any other better way ?

+2  A: 

Check this out: http://www.jonah.org/articles/crewait_go_.html

Jacob Relkin
But it will fire multiple insert queries. I want to store it with single query .
krunal shah
@krunal, You can't do multiple inserts in one query.
Jacob Relkin
doesn't Rails or Ruby have any method for single mass insert ?
krunal shah
@krunal, See my updated answer.
Jacob Relkin
@krunal, Can you accept an answer?
Jacob Relkin