Sha256: 76e52e8edc3df4f44756894d2e05d5ee1eddc9a600e0a9c09bf3736c84817f8a
Contents?: true
Size: 680 Bytes
Versions: 110
Compression:
Stored size: 680 Bytes
Contents
class MigrateTagsToSidecars < ActiveRecord::Migration[5.0] def up Spotlight::SolrDocumentSidecar.reset_column_information ActsAsTaggableOn::Tagging.reset_column_information ActsAsTaggableOn::Tagging.where(taggable_type: 'SolrDocument', tagger_type: 'Spotlight::Exhibit').find_each do |e| sidecar = Spotlight::SolrDocumentSidecar.find_or_create_by(document_id: e.taggable_id, document_type: 'SolrDocument', exhibit_id: e.tagger_id) e.update(taggable: sidecar) end end def down ActsAsTaggableOn::Tagging.where(taggable_type: 'Spotlight::SolrDocumentSidecar').find_each do |e| e.update(taggable: e.taggable.document) end end end
Version data entries
110 entries across 110 versions & 1 rubygems