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:
		
							parent
							
								
									c951cc6b6f
								
							
						
					
					
						commit
						f092aff9e9
					
				| 
						 | 
				
			
			@ -46,19 +46,22 @@ namespace :data_migration do
 | 
			
		|||
 | 
			
		||||
  task :make_bulletins_and_news_has_language_flag => :environment do
 | 
			
		||||
    a = []
 | 
			
		||||
    i = 0
 | 
			
		||||
    [Bulletin,NewsBulletin].each do |bulletin|
 | 
			
		||||
      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 )
 | 
			
		||||
          "OK"
 | 
			
		||||
        else
 | 
			
		||||
          'Failed'
 | 
			
		||||
          a << bt.id
 | 
			
		||||
          'Failed'
 | 
			
		||||
        end
 | 
			
		||||
        i += 1
 | 
			
		||||
        puts((bt.title.to_s rescue '') + "----------#{result}") 
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    p a
 | 
			
		||||
    p i
 | 
			
		||||
    puts("#{'='*10}Finished#{'='*10}")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in New Issue