module ActsAsFollower::FollowScopes
Public Instance Methods
blocked()
click to toggle source
returns blocked Follow
records.
# File lib/acts_as_follower/follow_scopes.rb, line 40 def blocked where(blocked: true) end
descending()
click to toggle source
returns Follow
records in descending order.
# File lib/acts_as_follower/follow_scopes.rb, line 30 def descending order("follows.created_at DESC") end
for_followable(followable)
click to toggle source
returns Follow
records where followable is the record passed in.
# File lib/acts_as_follower/follow_scopes.rb, line 10 def for_followable(followable) where(followable_id: followable.id, followable_type: parent_class_name(followable)) end
for_followable_type(followable_type)
click to toggle source
returns Follow
records where followeable_type is the record passed in.
# File lib/acts_as_follower/follow_scopes.rb, line 20 def for_followable_type(followable_type) where(followable_type: followable_type) end
for_follower(follower)
click to toggle source
returns Follow
records where follower is the record passed in.
# File lib/acts_as_follower/follow_scopes.rb, line 5 def for_follower(follower) where(follower_id: follower.id, follower_type: parent_class_name(follower)) end
for_follower_type(follower_type)
click to toggle source
returns Follow
records where follower_type is the record passed in.
# File lib/acts_as_follower/follow_scopes.rb, line 15 def for_follower_type(follower_type) where(follower_type: follower_type) end
recent(from)
click to toggle source
returns Follow
records from past 2 weeks with default parameter.
# File lib/acts_as_follower/follow_scopes.rb, line 25 def recent(from) where(["created_at > ?", (from || 2.weeks.ago).to_s(:db)]) end
unblocked()
click to toggle source
returns unblocked Follow
records.
# File lib/acts_as_follower/follow_scopes.rb, line 35 def unblocked where(blocked: false) end