Sha256: 3ee40c02e33ef40d1e90385c3392ea3d60bd371470e51c492573eb4b56cbd4c1

Contents?: true

Size: 630 Bytes

Versions: 17

Compression:

Stored size: 630 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.cardname.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.default_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

17 entries across 17 versions & 1 rubygems

Version Path
card-1.92.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.92.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.92 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.91 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.21.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.20.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.20.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.20.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.20.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.20.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.6 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.5 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.19.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb