Merge pull request #4794 from oliverguenther/fix/23810/empty-wiki-menu-items

[23810] Fix migration with missing wiki associations
pull/4795/head
Oliver Günther 8 years ago committed by GitHub
commit 64e7099fa7
  1. 7
      db/migrate/20160803094931_wiki_menu_titles_to_slug.rb

@ -14,8 +14,13 @@ class WikiMenuTitlesToSlug < ActiveRecord::Migration
def migrate_menu_items
ActiveRecord::Base.transaction do
::MenuItems::WikiMenuItem.includes(:wiki).find_each do |item|
# We need the associated wiki to be present
wiki = item.wiki
next if wiki.nil?
# Find the page
wiki_page = item.wiki.find_page(item.title)
wiki_page = wiki.find_page(item.title)
# Set the title to the actual slug
# If the page could not be found, migrate the title to form a slug

Loading…
Cancel
Save