Fix category migration
This commit is contained in:
parent
5d3bc07488
commit
de6ce0073f
|
@ -29,9 +29,10 @@ namespace :new_ui do
|
|||
category_name = model_name unless category_name
|
||||
# # coll_cat = @db["#{category_name}_categories"]
|
||||
# # categories = coll_cat.find if coll_cat
|
||||
categories = "#{category_name}_categories".classify.constantize.admin_manager_all
|
||||
categories = "#{category_name}_categories".classify.constantize.all if categories.blank?
|
||||
module_app = ModuleApp.where(key: app_key)[0]
|
||||
if module_app.has_category
|
||||
categories = "#{category_name}_categories".classify.constantize.admin_manager_all rescue nil
|
||||
categories = "#{category_name}_categories".classify.constantize.all if categories.blank?
|
||||
categories.each do |category|
|
||||
new_category = module_app.categories.build
|
||||
new_category.title_translations = category['title']
|
||||
|
@ -63,6 +64,7 @@ namespace :new_ui do
|
|||
category.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :migrate_tags => :environment do
|
||||
tags = Tag.where(_type: 'Tag')
|
||||
|
|
Reference in New Issue