I have this ruby function which yields 1095 records MusicTab::FOps.gen_list('/fun/Music')
and I want to store them using datamapper. When I do this
MusicTab::FOps.gen_list('/fun/Music') do |arr_f|
@files=Files.create(
:file_path => arr_f[0],
:title => arr_f[1],
:album => arr_f[2],
:artist => arr_f[3] )
end
only 154 records are inserted, I don't understand what is so special about these records. If I do this I get nil for p @files.id all the other records other than those 154 records which gets stored.
MusicTab::FOps.gen_list('/fun/Music') do |arr_f|
@files=Files.create(
:file_path => arr_f[0],
:title => arr_f[1],
:album => arr_f[2],
:artist => arr_f[3] )
p @files.id
p @files.title
p @files.album
end
If I just print the values I can see all the values like
counter=0
MusicTab::FOps.gen_list('/fun/Music') do |arr_f|
p arr_f
counter=counter+1
end
counter
please help.. Regards