fav_star 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fav_star.gemspec +2 -2
- data/lib/acts_as_faveable.rb +17 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/fav_star.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fav_star}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brady Bouchard"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-20}
|
13
13
|
s.description = %q{fav_star provides a fairly straightforward module that allows you to keep track of which models your users have favourited.}
|
14
14
|
s.email = %q{brady@ldawn.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/acts_as_faveable.rb
CHANGED
@@ -15,6 +15,16 @@ module FavStar
|
|
15
15
|
end
|
16
16
|
|
17
17
|
module SingletonMethods
|
18
|
+
|
19
|
+
def faved_by(faver)
|
20
|
+
self.joins(:faves).where(
|
21
|
+
:faves => {
|
22
|
+
:faver_type => faver.class.name,
|
23
|
+
:faver_id => faver.id
|
24
|
+
}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
18
28
|
end
|
19
29
|
|
20
30
|
module InstanceMethods
|
@@ -23,9 +33,15 @@ module FavStar
|
|
23
33
|
Fave.where(:faveable_id => id, :faveable_type => self.class.name).count
|
24
34
|
end
|
25
35
|
|
26
|
-
def
|
36
|
+
def favers
|
27
37
|
self.faves.map(&:faver).uniq
|
28
38
|
end
|
39
|
+
|
40
|
+
# DEPRECIATED:
|
41
|
+
def favers_who_faved
|
42
|
+
puts "The method 'favers_who_faved' has been depreciated in favour of just 'favers'."
|
43
|
+
favers
|
44
|
+
end
|
29
45
|
|
30
46
|
def faved_by?(faver)
|
31
47
|
0 < Fave.where(
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brady Bouchard
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-20 00:00:00 +10:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|