Fix for data_migration but there's still a bug with red is, the red is code has to be commented out to run the rake task

This commit is contained in:
Christophe Vilayphiou 2012-08-01 02:43:06 +08:00
parent c951cc6b6f
commit f092aff9e9
1 changed files with 5 additions and 2 deletions

View File

@ -46,19 +46,22 @@ namespace :data_migration do
task :make_bulletins_and_news_has_language_flag => :environment do task :make_bulletins_and_news_has_language_flag => :environment do
a = [] a = []
i = 0
[Bulletin,NewsBulletin].each do |bulletin| [Bulletin,NewsBulletin].each do |bulletin|
puts "="*10 + bulletin.to_s + "="*10 puts "="*10 + bulletin.to_s + "="*10
bulletin.all.each do |bt| bulletin.admin_manager_all.each do |bt|
result = if (bt.save(:validate => false) rescue false ) result = if (bt.save(:validate => false) rescue false )
"OK" "OK"
else else
'Failed'
a << bt.id a << bt.id
'Failed'
end end
i += 1
puts((bt.title.to_s rescue '') + "----------#{result}") puts((bt.title.to_s rescue '') + "----------#{result}")
end end
end end
p a p a
p i
puts("#{'='*10}Finished#{'='*10}") puts("#{'='*10}Finished#{'='*10}")
end end