Structure link with json
This commit is contained in:
1 parent
a4d1c68299
commit
8ebfac2b99
13 files changed
+124
-136
No files matched your search
@@ -58,6 +58,10 @@ namespace :new_ui do
|
||||
menu_enabled_for_to_hash
|
||||
end
|
||||
|
||||
task :link_url_to_hash => :environment do
|
||||
link_url_to_hash
|
||||
end
|
||||
|
||||
def migrate_categories(args = nil)
|
||||
if args && args[:app_key] && args[:model_name]
|
||||
migrate_category(args[:app_key], args[:model_name], args[:category_name])
|
||||
@@ -270,4 +274,17 @@ namespace :new_ui do
|
||||
end
|
||||
end
|
||||
|
||||
def link_url_to_hash
|
||||
@db ||= Mongoid.database
|
||||
collection_link = @db['items']
|
||||
links = collection_link.find({_type: 'Link'})
|
||||
links.each do |link|
|
||||
link['url'] = VALID_LOCALES.inject({}) do |enable, locale|
|
||||
enable[locale] = link['url']
|
||||
enable
|
||||
end
|
||||
collection_link.save(link)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user