Fix for data_migration
This commit is contained in:
parent
b2f28eabaf
commit
c951cc6b6f
|
@ -45,6 +45,7 @@ namespace :data_migration do
|
|||
end
|
||||
|
||||
task :make_bulletins_and_news_has_language_flag => :environment do
|
||||
a = []
|
||||
[Bulletin,NewsBulletin].each do |bulletin|
|
||||
puts "="*10 + bulletin.to_s + "="*10
|
||||
bulletin.all.each do |bt|
|
||||
|
@ -52,10 +53,12 @@ namespace :data_migration do
|
|||
"OK"
|
||||
else
|
||||
'Failed'
|
||||
a << bt.id
|
||||
end
|
||||
puts(bt.title+"----------#{result}")
|
||||
puts((bt.title.to_s rescue '') + "----------#{result}")
|
||||
end
|
||||
end
|
||||
p a
|
||||
puts("#{'='*10}Finished#{'='*10}")
|
||||
end
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ class Bulletin
|
|||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
unless title[locale].blank? || subtitle[locale].blank? || text[locale].blank?
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
self["available_for_#{locale}".to_sym] = false
|
||||
else
|
||||
self["available_for_#{locale}".to_sym] = true
|
||||
|
|
|
@ -205,7 +205,7 @@ class NewsBulletin
|
|||
protected
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
unless title[locale].blank? || subtitle[locale].blank? || text[locale].blank?
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
self["available_for_#{locale}".to_sym] = false
|
||||
else
|
||||
self["available_for_#{locale}".to_sym] = true
|
||||
|
|
Loading…
Reference in New Issue