Sha256: 583eab7fb20a0dac27fe2a9122f24bb3b1c59e5ea2e38813967cfb7a998a2834
Contents?: true
Size: 558 Bytes
Versions: 19
Compression:
Stored size: 558 Bytes
Contents
class AddSubscriberRoleToSpreeRoles < ActiveRecord::Migration def up Spree::Role.where(name: "subscriber").first_or_create Spree::Subscription.includes(:user).uniq.each do |subscription| subscription.add_role_subscriber unless subscription.user.has_spree_role?('subscriber') end end def down Spree::Subscription.includes(:user).uniq.each do |subscription| subscription.remove_role_subscriber if subscription.user.has_spree_role?('subscriber') end Spree::Role.where(name: "subscriber").first.try(:destroy) end end
Version data entries
19 entries across 19 versions & 1 rubygems