Sha256: cc902ef2b1a87a68f6fe6f4979e5ee78444000cba79e1807b85526e0402c67d8
Contents?: true
Size: 610 Bytes
Versions: 64
Compression:
Stored size: 610 Bytes
Contents
class MigrateOldPreferences < ActiveRecord::Migration 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
64 entries across 64 versions & 2 rubygems