Sha256: 6be8643afead936a09af12642591c246ed74e6e7c1a1c12619260a574bc8e810

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

class User < ActiveRecord::Base
  acts_as_follower
  acts_as_followable

  acts_as_permissor :of => [:following_users, :user_followers, :following_of_followings, :follower_of_followers], :class_name => 'User'

  def following_of_followings
    ids = []
    for user in following_users
      ids |= user.following_users
    end
    User.where(:id => ids)
  end

  def follower_of_followers
    ids = []
    for user in user_followers
      ids |= user.user_followers
    end
    User.where(:id => ids)
  end

  def is_following_user_of?(item)
    self.followed_by?(item)
  end

  def is_user_follower_of?(item)
    item.followed_by?(self)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
private_person-0.3.0 spec/dummy/app/models/user.rb
private_person-0.2.9 spec/dummy/app/models/user.rb
private_person-0.2.4 spec/dummy/app/models/user.rb
private_person-0.1.0 spec/dummy/app/models/user.rb