Module: ActsAsFollower::FollowScopes

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

Instance Method Summary collapse

Instance Method Details

#blockedObject



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

def blocked
  where(:blocked => true)
end

#descendingObject



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

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

#for_followable(followable) ⇒ Object



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

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

#for_followable_type(followable_type) ⇒ Object



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

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

#for_follower(follower) ⇒ Object



4
5
6
# 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



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

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

#recent(from) ⇒ Object



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

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

#unblockedObject



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

def unblocked
  where(:blocked => false)
end