Sha256: a3c3cf17a8f71ced507cf5103374687f4a6f22e0cfa2c52f783d488cad6dc124

Contents?: true

Size: 624 Bytes

Versions: 14

Compression:

Stored size: 624 Bytes

Contents

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

class FollowingToFollowRule < Card::CoreMigration
  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

14 entries across 14 versions & 1 rubygems

Version Path
card-1.17.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.17.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.17.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.17.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.17.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.15 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.14 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.13 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.12 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.11 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.10 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.9 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.8 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.7 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb