Remove comments in migrate task
This commit is contained in:
parent
b6f2325de6
commit
b7cc38c195
|
@ -4,344 +4,344 @@ namespace :migrate do
|
||||||
|
|
||||||
task :i18n => :environment do
|
task :i18n => :environment do
|
||||||
|
|
||||||
# p 'Start Bulletin'
|
p 'Start Bulletin'
|
||||||
# bulletins = Bulletin.admin_manager_all
|
bulletins = Bulletin.admin_manager_all
|
||||||
# i = 1
|
i = 1
|
||||||
# bulletins.each do |bulletin|
|
bulletins.each do |bulletin|
|
||||||
# p "#{i}/#{bulletins.size} - #{bulletin.id}"
|
p "#{i}/#{bulletins.size} - #{bulletin.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
|
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
|
||||||
# bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
|
subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
|
||||||
# bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle
|
bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle
|
||||||
# text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
|
text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
|
||||||
# bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text
|
bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text
|
||||||
# p bulletin.save(:validate => false)
|
p bulletin.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Bulletin'
|
p 'End Bulletin'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start BulletinCategory'
|
p 'Start BulletinCategory'
|
||||||
# categories = BulletinCategory.admin_manager_all
|
categories = BulletinCategory.admin_manager_all
|
||||||
# i = 1
|
i = 1
|
||||||
# categories.each do |category|
|
categories.each do |category|
|
||||||
# p "#{i}/#{categories.size} - #{category.id}"
|
p "#{i}/#{categories.size} - #{category.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
||||||
# category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p category.save(:validate => false)
|
p category.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End BulletinCategory'
|
p 'End BulletinCategory'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start BulletinFile'
|
p 'Start BulletinFile'
|
||||||
# files = BulletinFile.all
|
files = BulletinFile.all
|
||||||
# i = 1
|
i = 1
|
||||||
# files.each do |file|
|
files.each do |file|
|
||||||
# p "#{i}/#{files.size} - #{file.id}"
|
p "#{i}/#{files.size} - #{file.id}"
|
||||||
# description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
||||||
# file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
||||||
# file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p file.save(:validate => false)
|
p file.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End BulletinFile'
|
p 'End BulletinFile'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start BulletinLink'
|
p 'Start BulletinLink'
|
||||||
# links = BulletinLink.all
|
links = BulletinLink.all
|
||||||
# i = 1
|
i = 1
|
||||||
# links.each do |link|
|
links.each do |link|
|
||||||
# p "#{i}/#{links.size} - #{link.id}"
|
p "#{i}/#{links.size} - #{link.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class})
|
||||||
# link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p link.save(:validate => false)
|
p link.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End BulletinLink'
|
p 'End BulletinLink'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start UnitListForAnc'
|
p 'Start UnitListForAnc'
|
||||||
# units = UnitListForAnc.all
|
units = UnitListForAnc.all
|
||||||
# i = 1
|
i = 1
|
||||||
# units.each do |unit|
|
units.each do |unit|
|
||||||
# p "#{i}/#{units.size} - #{unit.id}"
|
p "#{i}/#{units.size} - #{unit.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => unit.id, :language_value_type => unit.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => unit.id, :language_value_type => unit.class})
|
||||||
# unit.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
unit.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p unit.save(:validate => false)
|
p unit.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End UnitListForAnc'
|
p 'End UnitListForAnc'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start NewsBulletin'
|
p 'Start NewsBulletin'
|
||||||
# news_bulletins = NewsBulletin.admin_manager_all
|
news_bulletins = NewsBulletin.admin_manager_all
|
||||||
# i = 1
|
i = 1
|
||||||
# news_bulletins.each do |news_bulletin|
|
news_bulletins.each do |news_bulletin|
|
||||||
# p "#{i}/#{news_bulletins.size} - #{news_bulletin.id}"
|
p "#{i}/#{news_bulletins.size} - #{news_bulletin.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
||||||
# news_bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
news_bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
||||||
# news_bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle
|
news_bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle
|
||||||
# text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
||||||
# news_bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text
|
news_bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text
|
||||||
# p news_bulletin.save(:validate => false)
|
p news_bulletin.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End NewsBulletin'
|
p 'End NewsBulletin'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start NewsBulletinCategory'
|
p 'Start NewsBulletinCategory'
|
||||||
# categories = NewsBulletinCategory.admin_manager_all
|
categories = NewsBulletinCategory.admin_manager_all
|
||||||
# i = 1
|
i = 1
|
||||||
# categories.each do |category|
|
categories.each do |category|
|
||||||
# p "#{i}/#{categories.size} - #{category.id}"
|
p "#{i}/#{categories.size} - #{category.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
||||||
# category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p category.save(:validate => false)
|
p category.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End NewsBulletinCategory'
|
p 'End NewsBulletinCategory'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start NewsBulletinFile'
|
p 'Start NewsBulletinFile'
|
||||||
# files = NewsBulletinFile.all
|
files = NewsBulletinFile.all
|
||||||
# i = 1
|
i = 1
|
||||||
# files.each do |file|
|
files.each do |file|
|
||||||
# p "#{i}/#{files.size} - #{file.id}"
|
p "#{i}/#{files.size} - #{file.id}"
|
||||||
# description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
||||||
# file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
||||||
# file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p file.save(:validate => false)
|
p file.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End NewsBulletinFile'
|
p 'End NewsBulletinFile'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start NewsBulletinLink'
|
p 'Start NewsBulletinLink'
|
||||||
# links = NewsBulletinLink.all
|
links = NewsBulletinLink.all
|
||||||
# i = 1
|
i = 1
|
||||||
# links.each do |link|
|
links.each do |link|
|
||||||
# p "#{i}/#{links.size} - #{link.id}"
|
p "#{i}/#{links.size} - #{link.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class})
|
||||||
# link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p link.save(:validate => false)
|
p link.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End NewsBulletinLink'
|
p 'End NewsBulletinLink'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start PageContext'
|
p 'Start PageContext'
|
||||||
# page_contexts = PageContext.all
|
page_contexts = PageContext.all
|
||||||
# i = 1
|
i = 1
|
||||||
# page_contexts.each do |page_context|
|
page_contexts.each do |page_context|
|
||||||
# p "#{i}/#{page_contexts.size} - #{page_context.id}"
|
p "#{i}/#{page_contexts.size} - #{page_context.id}"
|
||||||
# context = I18nVariable.first(:conditions => {:language_value_id => page_context.id, :language_value_type => page_context.class})
|
context = I18nVariable.first(:conditions => {:language_value_id => page_context.id, :language_value_type => page_context.class})
|
||||||
# page_context.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
|
page_context.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
|
||||||
# p page_context.save(:validate => false)
|
p page_context.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End PageContext'
|
p 'End PageContext'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start WebLink'
|
p 'Start WebLink'
|
||||||
# links = WebLink.all
|
links = WebLink.all
|
||||||
# i = 1
|
i = 1
|
||||||
# links.each do |link|
|
links.each do |link|
|
||||||
# p "#{i}/#{links.size} - #{link.id}"
|
p "#{i}/#{links.size} - #{link.id}"
|
||||||
# # the original key was 'name'
|
# the original key was 'name'
|
||||||
# title = I18nVariable.first(:conditions => {:key => 'name', :language_value_id => link.id, :language_value_type => link.class})
|
title = I18nVariable.first(:conditions => {:key => 'name', :language_value_id => link.id, :language_value_type => link.class})
|
||||||
# link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# context = I18nVariable.first(:conditions => {:key => 'context', :language_value_id => link.id, :language_value_type => link.class})
|
context = I18nVariable.first(:conditions => {:key => 'context', :language_value_id => link.id, :language_value_type => link.class})
|
||||||
# link.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
|
link.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
|
||||||
# p link.save(:validate => false)
|
p link.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End WebLink'
|
p 'End WebLink'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start WebLinkCategory'
|
p 'Start WebLinkCategory'
|
||||||
# categories = WebLinkCategory.admin_manager_all
|
categories = WebLinkCategory.admin_manager_all
|
||||||
# i = 1
|
i = 1
|
||||||
# categories.each do |category|
|
categories.each do |category|
|
||||||
# p "#{i}/#{categories.size} - #{category.id}"
|
p "#{i}/#{categories.size} - #{category.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
||||||
# category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p category.save(:validate => false)
|
p category.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End WebLinkCategory'
|
p 'End WebLinkCategory'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start Meta'
|
p 'Start Meta'
|
||||||
# metas = Meta.all
|
metas = Meta.all
|
||||||
# i = 1
|
i = 1
|
||||||
# metas.each do |meta|
|
metas.each do |meta|
|
||||||
# p "#{i}/#{metas.size} - #{meta.id}"
|
p "#{i}/#{metas.size} - #{meta.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => meta.id, :language_value_type => meta.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => meta.id, :language_value_type => meta.class})
|
||||||
# meta.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
meta.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p meta.save(:validate => false)
|
p meta.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Meta'
|
p 'End Meta'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start Attribute'
|
p 'Start Attribute'
|
||||||
# attributes = Attribute.all
|
attributes = Attribute.all
|
||||||
# i = 1
|
i = 1
|
||||||
# attributes.each do |attribute|
|
attributes.each do |attribute|
|
||||||
# p "#{i}/#{attributes.size} - #{attribute.id}"
|
p "#{i}/#{attributes.size} - #{attribute.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => attribute.id, :language_value_type => attribute.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => attribute.id, :language_value_type => attribute.class})
|
||||||
# attribute.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
attribute.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p attribute.save(:validate => false)
|
p attribute.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Attribute'
|
p 'End Attribute'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start AttributeField'
|
p 'Start AttributeField'
|
||||||
# attribute_fields = AttributeField.all
|
attribute_fields = AttributeField.all
|
||||||
# i = 1
|
i = 1
|
||||||
# attribute_fields.each do |attribute_field|
|
attribute_fields.each do |attribute_field|
|
||||||
# p "#{i}/#{attribute_fields.size} - #{attribute_field.id}"
|
p "#{i}/#{attribute_fields.size} - #{attribute_field.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => attribute_field.id, :language_value_type => attribute_field.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => attribute_field.id, :language_value_type => attribute_field.class})
|
||||||
# attribute_field.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
attribute_field.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p attribute_field.save(:validate => false)
|
p attribute_field.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End AttributeField'
|
p 'End AttributeField'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start Role'
|
p 'Start Role'
|
||||||
# roles = Role.all
|
roles = Role.all
|
||||||
# i = 1
|
i = 1
|
||||||
# roles.each do |role|
|
roles.each do |role|
|
||||||
# p "#{i}/#{roles.size} - #{role.id}"
|
p "#{i}/#{roles.size} - #{role.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => role.id, :language_value_type => role.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => role.id, :language_value_type => role.class})
|
||||||
# role.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
role.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p role.save(:validate => false)
|
p role.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Role'
|
p 'End Role'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start AdImage'
|
p 'Start AdImage'
|
||||||
# ad_images = AdImage.all
|
ad_images = AdImage.all
|
||||||
# i = 1
|
i = 1
|
||||||
# ad_images.each do |image|
|
ad_images.each do |image|
|
||||||
# p "#{i}/#{ad_images.size} - #{image.id}"
|
p "#{i}/#{ad_images.size} - #{image.id}"
|
||||||
# # no key is set and title = context, this is due to original error in the code
|
# no key is set and title = context, this is due to original error in the code
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => image.id, :language_value_type => image.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => image.id, :language_value_type => image.class})
|
||||||
# image.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
image.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# image.context_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
image.context_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p image.save(:validate => false)
|
p image.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End AdImage'
|
p 'End AdImage'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start Asset'
|
p 'Start Asset'
|
||||||
# assets = Asset.all
|
assets = Asset.all
|
||||||
# i = 1
|
i = 1
|
||||||
# assets.each do |asset|
|
assets.each do |asset|
|
||||||
# p "#{i}/#{assets.size} - #{asset.id}"
|
p "#{i}/#{assets.size} - #{asset.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => asset.id, :language_value_type => asset.class})
|
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => asset.id, :language_value_type => asset.class})
|
||||||
# asset.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
asset.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# description = I18nVariable.first(:conditions => {:key => 'description', :language_value_id => asset.id, :language_value_type => asset.class})
|
description = I18nVariable.first(:conditions => {:key => 'description', :language_value_id => asset.id, :language_value_type => asset.class})
|
||||||
# asset.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
asset.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
||||||
# p asset.save(:validate => false)
|
p asset.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Asset'
|
p 'End Asset'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start AssetCategory'
|
p 'Start AssetCategory'
|
||||||
# categories = AssetCategory.all
|
categories = AssetCategory.all
|
||||||
# i = 1
|
i = 1
|
||||||
# categories.each do |category|
|
categories.each do |category|
|
||||||
# p "#{i}/#{categories.size} - #{category.id}"
|
p "#{i}/#{categories.size} - #{category.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
||||||
# category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p category.save(:validate => false)
|
p category.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End AssetCategory'
|
p 'End AssetCategory'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start Item'
|
p 'Start Item'
|
||||||
# items = Item.all
|
items = Item.all
|
||||||
# i = 1
|
i = 1
|
||||||
# items.each do |item|
|
items.each do |item|
|
||||||
# p "#{i}/#{items.size} - #{item.id}"
|
p "#{i}/#{items.size} - #{item.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:language_value_id => item.id, :language_value_type => item.class})
|
title = I18nVariable.first(:conditions => {:language_value_id => item.id, :language_value_type => item.class})
|
||||||
# item.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
item.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p item.save(:validate => false)
|
p item.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Item'
|
p 'End Item'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start Page'
|
p 'Start Page'
|
||||||
# pages = Page.all
|
pages = Page.all
|
||||||
# i = 1
|
i = 1
|
||||||
# pages.each do |item|
|
pages.each do |item|
|
||||||
# p "#{i}/#{pages.size} - #{item.id}"
|
p "#{i}/#{pages.size} - #{item.id}"
|
||||||
# # the key was originally 'title', changed to 'page_title' to avoit conflict with parent
|
# the key was originally 'title', changed to 'page_title' to avoit conflict with parent
|
||||||
# title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => item.id, :language_value_type => item.class})
|
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => item.id, :language_value_type => item.class})
|
||||||
# item.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
item.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# p item.save(:validate => false)
|
p item.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End Page'
|
p 'End Page'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
# p 'Start PagePart'
|
p 'Start PagePart'
|
||||||
# page_parts = PagePart.all
|
page_parts = PagePart.all
|
||||||
# i = 1
|
i = 1
|
||||||
# page_parts.each do |part|
|
page_parts.each do |part|
|
||||||
# p "#{i}/#{page_parts.size} - #{part.id}"
|
p "#{i}/#{page_parts.size} - #{part.id}"
|
||||||
# title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => part.id, :language_value_type => part.class})
|
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => part.id, :language_value_type => part.class})
|
||||||
# part.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
part.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
||||||
# content = I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => part.id, :language_value_type => part.class})
|
content = I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => part.id, :language_value_type => part.class})
|
||||||
# part.content_translations = {'en' => content['en'], 'zh_tw' => content['zh_tw']} if content
|
part.content_translations = {'en' => content['en'], 'zh_tw' => content['zh_tw']} if content
|
||||||
# p part.save(:validate => false)
|
p part.save(:validate => false)
|
||||||
# i += 1
|
i += 1
|
||||||
# end
|
end
|
||||||
# p 'End PagePart'
|
p 'End PagePart'
|
||||||
|
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
# p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
p 'Start Site'
|
p 'Start Site'
|
||||||
site = Site.first
|
site = Site.first
|
||||||
|
|
Loading…
Reference in New Issue