acts_as_followable 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -41,9 +41,10 @@ To stop following an object use the following:
41
41
 
42
42
  user.stop_following(book)
43
43
 
44
- You can remove all the followers like this:
44
+ You can remove all the followers/followings like this:
45
45
 
46
- user.remove_followers_by_type('Book')
46
+ user.destroy_followers_by_type('User')
47
+ user.destroy_followings_by_type('Book')
47
48
 
48
49
  You can check to see if an object is following another object through the following:
49
50
 
@@ -64,10 +64,15 @@ module ActsAsFollowable
64
64
  end
65
65
 
66
66
  # Destroys all followers of a given type
67
- def remove_followers_by_type(type)
67
+ def destroy_followers_by_type(type)
68
68
  Follow.where(['follows.followable_id=? AND follows.followable_type=? AND follows.follower_type=?', self.id, self.class.name, type]).destroy_all
69
69
  end
70
70
 
71
+ # Destroys all followings of a given type
72
+ def destroy_followings_by_type(type)
73
+ Follow.where(['follows.follower_id=? AND follows.follower_type=? AND follows.followable_type=?', self.id, self.class.name, type]).destroy_all
74
+ end
75
+
71
76
  # Returns true if the current instance is followed by the passed record
72
77
  def followed_by?(follower)
73
78
  0 < follow_for_follower(follower).limit(1).count
@@ -2,7 +2,7 @@ module ActsAsFollowable
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_followable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kristijan Sedlak