Sha256: 7582c8a139e1a4bf2a3dd6dd86ba5ce0d95694add5a6c62e93cc10d50267d37f

Contents?: true

Size: 601 Bytes

Versions: 81

Compression:

Stored size: 601 Bytes

Contents

# frozen_string_literal: true

module Migration
  ##
  # This migration sets the Spotlight::Page locale to the I18n.default_locale.
  # Needed for migrating Exhibits to internationalization work.
  class PageLanguage
    def self.run
      new.run
    end

    def initialize; end

    def run
      migrate_pages
    end

    private

    def migrate_pages
      FriendlyId::Slug.where(sluggable_type: 'Spotlight::Page').find_each do |slug|
        unless /locale:\w+/ =~ slug.scope
          slug.scope += ",locale:#{I18n.default_locale}"
          slug.save
        end
      end
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
blacklight-spotlight-4.7.0 lib/migration/page_language.rb
blacklight-spotlight-4.6.1 lib/migration/page_language.rb
blacklight-spotlight-4.6.0 lib/migration/page_language.rb
blacklight-spotlight-4.5.0 lib/migration/page_language.rb
blacklight-spotlight-4.4.0 lib/migration/page_language.rb
blacklight-spotlight-4.3.6 lib/migration/page_language.rb
blacklight-spotlight-4.3.5 lib/migration/page_language.rb
blacklight-spotlight-4.3.4 lib/migration/page_language.rb
blacklight-spotlight-4.3.3 lib/migration/page_language.rb
blacklight-spotlight-4.3.2 lib/migration/page_language.rb
blacklight-spotlight-4.3.1 lib/migration/page_language.rb
blacklight-spotlight-4.3.0 lib/migration/page_language.rb
blacklight-spotlight-4.2.0 lib/migration/page_language.rb
blacklight-spotlight-4.1.2 lib/migration/page_language.rb
blacklight-spotlight-4.1.1 lib/migration/page_language.rb
blacklight-spotlight-4.1.0 lib/migration/page_language.rb
blacklight-spotlight-4.0.3 lib/migration/page_language.rb
blacklight-spotlight-4.0.2 lib/migration/page_language.rb
blacklight-spotlight-4.0.1 lib/migration/page_language.rb
blacklight-spotlight-4.0.0 lib/migration/page_language.rb