app/models/page.rb
# Occasionally you'll see "NO NAME" for some page IDs (in searches, associations, collections, and so on), and this
# can be caused by the native_node_id being set to a node that no longer exists. You should try and track down the
# source of that problem, but this code can be used to (slowly) fix the problem, where it's possible to do so:
Occasionally you'll see "NO NAME" for some page IDs (in searches, associations, collections, and so on), and this
can be caused by the native_node_id being set to a node that no longer exists. You should try and track down the
source of that problem, but this code can be used to (slowly) fix the problem, where it's possible to do so.
Occasionally you ' ll see " NO NAME " for some page IDs ( in searches associations collections and so on ) and this can be caused by the native_node_id being set to a node that no longer exists . You should try and track down the source of that problem but this code can be used to ( slowly ) fix the problem where it ' s possible to do so .
def fix_zombie_icons
      Page.where('medium_id IS NOT NULL').eager_load(:medium).merge(Medium.where(id: nil)).find_in_batches do |batch|
        Page.where(id: batch.map(&:id)).update_all(medium_id: nil)
      end
    end
def fix_zombie_icons Page . where ( 'medium_id IS NOT NULL' ) . eager_load ( :medium ) . merge ( Medium . where ( id : nil ) ) . find_in_batches do | batch | Page . where ( id : batch . map ( & :id ) ) . update_all ( medium_id : nil ) end end
Occasionally you'll see "NO NAME" for some page IDs (in searches, associations, collections, and so on), and this
can be caused by the native_node_id being set to a node that no longer exists.
Occasionally you ' ll see " NO NAME " for some page IDs ( in searches associations collections and so on ) and this can be caused by the native_node_id being set to a node that no longer exists .
# NOTE: this is less than stellar efficiency, since it loads the batches into memory but doesn't need them. But # this isn't important enough code to explode it to the verbose, efficient verison: