Sha256: fb7180d1e675441e0330fc9d679120dae98714bf5a2fea9150589565b7e64e50

Contents?: true

Size: 618 Bytes

Versions: 27

Compression:

Stored size: 618 Bytes

Contents

# -*- encoding : utf-8 -*-

class FollowingToFollowRule < Card::Migration::Core
  def up
    Card.search(right: { codename: "following" }, left: { type: "user" }).each do |following_card|
      user_name = following_card.name.left
      following_card.item_names.each do |followed_set_name|
        set_card = Card.fetch(followed_set_name, new: {})
        if set_card.type_code != :set
          set_card = set_card.follow_set_card
        end
        rule = Card.fetch set_card.follow_rule_name(user_name), new: { type: "pointer" }
        rule.content = "[[*always]]"
        rule.save!
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
card-1.100.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.6 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.5 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.99.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.98.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.98.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.98.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.98.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.97.0.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.97.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.96.8 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.96.7 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.96.6 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.96.5 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.96.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.96.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb