Module: ActsAsFollower::FollowScopes

Included in:
Follow
Defined in:
lib/acts_as_follower/follow_scopes.rb

Instance Method Summary collapse

Instance Method Details

#blockedObject


33
34
35
# File 'lib/acts_as_follower/follow_scopes.rb', line 33

def blocked
  where(:blocked => true)
end

#descendingObject


25
26
27
# File 'lib/acts_as_follower/follow_scopes.rb', line 25

def descending
  order("follows.created_at DESC")
end

#for_followable(followable) ⇒ Object


9
10
11
# File 'lib/acts_as_follower/follow_scopes.rb', line 9

def for_followable(followable)
  where(:followable_id => followable.id, :followable_type => parent_class_name(followable))
end

#for_followable_type(followable_type) ⇒ Object


17
18
19
# File 'lib/acts_as_follower/follow_scopes.rb', line 17

def for_followable_type(followable_type)
  where(:followable_type => followable_type)
end

#for_follower(follower) ⇒ Object


4
5
6
7
# File 'lib/acts_as_follower/follow_scopes.rb', line 4

def for_follower(follower)
  where(:follower_id => follower.id,
        :follower_type => parent_class_name(follower))
end

#for_follower_type(follower_type) ⇒ Object


13
14
15
# File 'lib/acts_as_follower/follow_scopes.rb', line 13

def for_follower_type(follower_type)
  where(:follower_type => follower_type)
end

#recent(from) ⇒ Object


21
22
23
# File 'lib/acts_as_follower/follow_scopes.rb', line 21

def recent(from)
  where(["created_at > ?", (from || 2.weeks.ago).to_s(:db)])
end

#unblockedObject


29
30
31
# File 'lib/acts_as_follower/follow_scopes.rb', line 29

def unblocked
  where(:blocked => false)
end