v0.8.0
parent
9debad6310
commit
c7ce1d256a
|
@ -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
|
## v0.7.0
|
||||||
|
|
||||||
### News
|
### News
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
rating (0.7.0)
|
rating (0.8.0)
|
||||||
activerecord (>= 4.2, < 6)
|
activerecord (>= 4.2, < 6)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
|
@ -40,7 +40,7 @@ GEM
|
||||||
crass (1.0.3)
|
crass (1.0.3)
|
||||||
database_cleaner (1.6.2)
|
database_cleaner (1.6.2)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
erubi (1.7.0)
|
erubi (1.7.1)
|
||||||
factory_bot (4.8.2)
|
factory_bot (4.8.2)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
factory_bot_rails (4.8.2)
|
factory_bot_rails (4.8.2)
|
||||||
|
@ -100,9 +100,9 @@ GEM
|
||||||
rspec-mocks (~> 3.7.0)
|
rspec-mocks (~> 3.7.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-support (3.7.1)
|
rspec-support (3.7.1)
|
||||||
rubocop (0.52.1)
|
rubocop (0.53.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.4.0.2, < 3.0)
|
parser (>= 2.5)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
|
|
18
README.md
18
README.md
|
@ -392,6 +392,24 @@ rating:
|
||||||
- scope_2
|
- 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!
|
## 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! (:
|
Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=rating) or [Patreon](https://www.patreon.com/wbotelhos). Thanks! (:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Rating
|
module Rating
|
||||||
VERSION = '0.7.0'
|
VERSION = '0.8.0'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue