Sha256: c72d09b8e3179809cd3517e96f938e4ae624096db27e29daa553130c5cb5a450

Contents?: true

Size: 631 Bytes

Versions: 17

Compression:

Stored size: 631 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

17 entries across 17 versions & 1 rubygems

Version Path
card-1.16.6 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.5 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.16.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.7 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.6 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.5 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.4 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.3 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.1 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.0 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.pre2 db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
card-1.15.pre db/migrate_core_cards/20150220134731_following_to_follow_rule.rb