Sha256: b0055da38671e13816604103a517b37dc3823790ac376fe0bf7a0aa83f1d5bb0

Contents?: true

Size: 456 Bytes

Versions: 1

Compression:

Stored size: 456 Bytes

Contents

module ActsAsFriendable
  extend ActiveSupport::Concern

  module ClassMethods

  end

  def friends
    direct_friends | inverse_friends
  end

  def friend_ids
    friends.map {|f| f.id}
  end

  def friend_ids_and_me
    friend_ids << id
  end

  def pending_and_friend_ids
    pending_and_friend_ids = []
    pending_and_friend_ids << friend_ids
    pending_and_friend_ids << pending_friends.map {|f| f.id}
    pending_and_friend_ids.flatten
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_friendable-1.0.1 lib/acts_as_friendable/model_additions.rb