Sha256: b32f280e0636f6ca34015f641697f02508423b3d7a981e4fe83b9e1feabe62be

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 Bytes

Contents

module SocialAuth
  module ActsAsSocialUser
    extend ActiveSupport::Concern

    included do

      def friends_that_use_the_app
        self.class.joins(:services).where('social_auth_services.remote_id IN (?)', remote_ids)
      end

      def remote_ids
        remote_ids = services.map(&:friend_ids).flatten.map(&:to_s)
      end

    end

    module ClassMethods
      def acts_as_social_user(options = {})
        has_many :services, foreign_key: options[:foreign_key] || :user_id, class_name: SocialAuth::Service, dependent: :destroy
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
social_auth-0.0.13 lib/social_auth/acts_as_social_user.rb
social_auth-0.0.12 lib/social_auth/acts_as_social_user.rb
social_auth-0.0.11 lib/social_auth/acts_as_social_user.rb
social_auth-0.0.10 lib/social_auth/acts_as_social_user.rb