Sha256: 1d97f8445a3e6de072031878933148ed8cce7e6f3d41c500803b1a810848cf3b

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 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 stop_following!(user)
      <%=friendship_class_name%>.stop_following!(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.1 lib/generators/redis_friendships/templates/user_injection_code.rb