main
Washington Botelho 2018-03-05 20:34:10 -03:00
parent 9debad6310
commit c7ce1d256a
No known key found for this signature in database
GPG Key ID: 5DE4F42A8F073617
4 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,9 @@
## v0.8.0
### News
- Adds `unscoped_rating` option to calculate the rating counting all resource record ignoring the scope.
## v0.7.0
### News

View File

@ -1,7 +1,7 @@
PATH
remote: .
specs:
rating (0.7.0)
rating (0.8.0)
activerecord (>= 4.2, < 6)
GEM
@ -40,7 +40,7 @@ GEM
crass (1.0.3)
database_cleaner (1.6.2)
diff-lcs (1.3)
erubi (1.7.0)
erubi (1.7.1)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_bot_rails (4.8.2)
@ -100,9 +100,9 @@ GEM
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubocop (0.52.1)
rubocop (0.53.0)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)

View File

@ -392,6 +392,24 @@ rating:
- scope_2
```
### Unscoped Rating
All rating values are grouped by the scope, but you can disable it and group all of them.
```ruby
rating unscoped_rating: true
author = User.last
resource = Article.last
scope = Category.last
author.rate resource, 1, scope: scope
author.rate resource, 2, scope: scope
author.rate resource, 3
```
Now the `sum` will be `6` and the `total` will be `3` because all rating will be calculated into just one rating record ignoring the `scopeable` object. The rating record is always saved on the record with `scopeable` as `nil`.
## Love it!
Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=rating) or [Patreon](https://www.patreon.com/wbotelhos). Thanks! (:

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true
module Rating
VERSION = '0.7.0'
VERSION = '0.8.0'
end