Sha256: 5706319b52c7adbe5875c8794e49ad03eed898b68f9a8901ac689be89a5019da
Contents?: true
Size: 677 Bytes
Versions: 6
Compression:
Stored size: 677 Bytes
Contents
# This migration comes from spree (originally 20140309023735) class MigrateOldPreferences < ActiveRecord::Migration[4.2] def up migrate_preferences(Spree::Calculator) migrate_preferences(Spree::PaymentMethod) migrate_preferences(Spree::PromotionRule) end def down end private def migrate_preferences klass klass.reset_column_information klass.find_each do |record| store = Spree::Preferences::ScopedStore.new(record.class.name.underscore, record.id) record.defined_preferences.each do |key| value = store.fetch(key){} record.preferences[key] = value unless value.nil? end record.save! end end end
Version data entries
6 entries across 6 versions & 1 rubygems