module ActsAsAble::Followable::InstanceMethods
Public Instance Methods
followers_by_type(follower_type, options = {})
click to toggle source
# File lib/acts_as_able/followable.rb, line 24 def followers_by_type(follower_type, options = {}) ids = Follow. where('followable_id' => self.id, 'followable_type' => class_name(self), 'follower_type' => follower_type.name ).pluck('follower_id') return follower_type.where("id in (?)", ids) end
followers_count()
click to toggle source
1: 查看某个 模型 关注我的所有对象 2: 查看某个 模型 的某个 实例 是否关注我了
# File lib/acts_as_able/followable.rb, line 20 def followers_count self.followers.count end