mreinsch-acts_as_rateable 2.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +11 -0
- data/README.rdoc +15 -2
- data/Rakefile +1 -1
- data/lib/acts_as_rateable.rb +2 -2
- metadata +7 -4
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
== 2.0 released 2009-7-22
|
2
|
+
|
3
|
+
* Refactored database structure for better performance: the average rating and ratings count are now pre-computed and updated when new ratings are recorded
|
4
|
+
* The API now requires consistently the user object instead of the user_id
|
5
|
+
* Added testing framework and unit tests
|
6
|
+
* Made available as ruby gem
|
7
|
+
|
8
|
+
== 1.0 released 2008
|
9
|
+
|
10
|
+
* The original acts_as_rateable plugin, first release by Ferenc Fekete
|
11
|
+
|
data/README.rdoc
CHANGED
@@ -14,9 +14,22 @@ The original plugin is used on cotcot.hu for article rating, sponsored quizzes,
|
|
14
14
|
|
15
15
|
= Installation
|
16
16
|
|
17
|
-
|
17
|
+
== Install as gem (recommended)
|
18
18
|
|
19
|
-
|
19
|
+
Install as a gem:
|
20
|
+
|
21
|
+
$ sudo gem install mreinsch-acts_as_rateable
|
22
|
+
|
23
|
+
Then add the gem dependency in your config:
|
24
|
+
|
25
|
+
# config/environment.rb
|
26
|
+
config.gem "mreinsch-acts_as_rateable", :source => "http://gems.github.com", :lib => "acts_as_rateable"
|
27
|
+
|
28
|
+
== Install as plugin
|
29
|
+
|
30
|
+
To install as a plugin, use:
|
31
|
+
|
32
|
+
$ ./script/plugin install git://github.com/mreinsch/acts_as_rateable.git
|
20
33
|
|
21
34
|
= Example Usage
|
22
35
|
|
data/Rakefile
CHANGED
@@ -17,6 +17,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
17
17
|
rdoc.rdoc_dir = 'rdoc'
|
18
18
|
rdoc.title = 'ActsAsRatable'
|
19
19
|
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc')
|
21
21
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
22
|
end
|
data/lib/acts_as_rateable.rb
CHANGED
@@ -64,12 +64,12 @@ module ActiveRecord
|
|
64
64
|
|
65
65
|
# Checks whether a user rated the object or not.
|
66
66
|
def rated_by?(user)
|
67
|
-
rating.user_ratings.exists?(:user_id => user)
|
67
|
+
rating && rating.user_ratings.exists?(:user_id => user)
|
68
68
|
end
|
69
69
|
|
70
70
|
# Returns the rating a specific user has given the object.
|
71
71
|
def rating_by(user)
|
72
|
-
user_rating = rating.user_ratings.find_by_user_id(user.id)
|
72
|
+
user_rating = rating && rating.user_ratings.find_by_user_id(user.id)
|
73
73
|
user_rating ? user_rating.score : nil
|
74
74
|
end
|
75
75
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mreinsch-acts_as_rateable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferenc Fekete
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-
|
14
|
+
date: 2009-09-23 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|
@@ -22,10 +22,12 @@ executables: []
|
|
22
22
|
extensions: []
|
23
23
|
|
24
24
|
extra_rdoc_files:
|
25
|
-
- MIT-LICENSE
|
26
25
|
- README.rdoc
|
26
|
+
- CHANGELOG.rdoc
|
27
|
+
- MIT-LICENSE
|
27
28
|
files:
|
28
29
|
- README.rdoc
|
30
|
+
- CHANGELOG.rdoc
|
29
31
|
- MIT-LICENSE
|
30
32
|
- Rakefile
|
31
33
|
- init.rb
|
@@ -39,6 +41,7 @@ files:
|
|
39
41
|
- generators/acts_as_rateable_migration/acts_as_rateable_migration_generator.rb
|
40
42
|
has_rdoc: true
|
41
43
|
homepage: http://github.com/mreinsch/acts_as_rateable
|
44
|
+
licenses:
|
42
45
|
post_install_message:
|
43
46
|
rdoc_options:
|
44
47
|
- --main
|
@@ -60,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
63
|
requirements: []
|
61
64
|
|
62
65
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.3.5
|
64
67
|
signing_key:
|
65
68
|
specification_version: 2
|
66
69
|
summary: Rails plugin providing a rating interface for ActiveRecord models
|