Sha256: ea9ec5b4e262620958aee6ce6e6c8f2c1340b93eaf333ebd17b13ff4d59338c8

Contents?: true

Size: 778 Bytes

Versions: 1

Compression:

Stored size: 778 Bytes

Contents

  def followed_by?(user)
    <%=friendship_class_name%>.followed_by?(self.username, user.username)
  end

  def follows?(user)
    <%=friendship_class_name%>.follows?(self.username, user.username)
  end

  def follow!(user)
    return false if self.username == user.username
    <%=friendship_class_name%>.follow!(self.username, user.username)
    true
  end
  
  def unfollow!(user)
      <%=friendship_class_name%>.unfollow!(self.username, user.username)
  end

  
  def followers
    followers = <%= friendship_class_name %>.followers_for(self.username)
    <%= user_class_name %>.where(:username => followers)
  end

  def followings
    followings = <%= friendship_class_name %>.followings_for(self.username)
    <%= user_class_name %>.where(:username => followings)
  end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-friendships-0.2 lib/generators/redis_friendships/templates/user_injection_code.rb