From 098a29803df20a1b60f1838d6d9a29466bf6f281 Mon Sep 17 00:00:00 2001 From: Amol Udage Date: Thu, 26 Nov 2015 01:15:13 +0530 Subject: [PATCH] Add short description for ActsAsFollower::FollowScopes methods --- lib/acts_as_follower/follow_scopes.rb | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/acts_as_follower/follow_scopes.rb b/lib/acts_as_follower/follow_scopes.rb index 17a01eb..32ea6eb 100644 --- a/lib/acts_as_follower/follow_scopes.rb +++ b/lib/acts_as_follower/follow_scopes.rb @@ -1,35 +1,43 @@ module ActsAsFollower #:nodoc: module FollowScopes + # returns Follow records where follower is the record passed in. def for_follower(follower) where(:follower_id => follower.id, :follower_type => parent_class_name(follower)) end + # returns Follow records where followable is the record passed in. def for_followable(followable) where(:followable_id => followable.id, :followable_type => parent_class_name(followable)) end + # returns Follow records where follower_type is the record passed in. def for_follower_type(follower_type) where(:follower_type => follower_type) end + # returns Follow records where followeable_type is the record passed in. def for_followable_type(followable_type) where(:followable_type => followable_type) end + # returns Follow records from past 2 weeks with default parameter. def recent(from) where(["created_at > ?", (from || 2.weeks.ago).to_s(:db)]) end + # returns Follow records in descending order. def descending order("follows.created_at DESC") end + # returns unblocked Follow records. def unblocked where(:blocked => false) end + # returns blocked Follow records. def blocked where(:blocked => true) end -- libgit2 0.21.0