Sha256: 4335f3846b58953ba49173dc8ea6c27f0505b89bee63ca77a855215957ecfed2

Contents?: true

Size: 570 Bytes

Versions: 18

Compression:

Stored size: 570 Bytes

Contents

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

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 lib/migration/page_language.rb
blacklight-spotlight-2.4.0 lib/migration/page_language.rb
blacklight-spotlight-2.3.3 lib/migration/page_language.rb
blacklight-spotlight-2.3.2 lib/migration/page_language.rb
blacklight-spotlight-2.3.1 lib/migration/page_language.rb
blacklight-spotlight-2.3.0 lib/migration/page_language.rb
blacklight-spotlight-2.2.1 lib/migration/page_language.rb
blacklight-spotlight-2.2.0 lib/migration/page_language.rb
blacklight-spotlight-2.1.0 lib/migration/page_language.rb
blacklight-spotlight-2.0.2 lib/migration/page_language.rb
blacklight-spotlight-2.0.1 lib/migration/page_language.rb
blacklight-spotlight-2.0.0 lib/migration/page_language.rb
blacklight-spotlight-2.0.0.rc6 lib/migration/page_language.rb
blacklight-spotlight-2.0.0.rc5 lib/migration/page_language.rb
blacklight-spotlight-2.0.0.rc4 lib/migration/page_language.rb
blacklight-spotlight-2.0.0.rc3 lib/migration/page_language.rb
blacklight-spotlight-2.0.0.rc2 lib/migration/page_language.rb
blacklight-spotlight-2.0.0.rc1 lib/migration/page_language.rb