v0.10.0
parent
e84b9b13a5
commit
4c92dfad30
|
@ -1,3 +1,9 @@
|
|||
## v0.10.0
|
||||
|
||||
### News
|
||||
|
||||
- Add option `where` to be able adds conditions on `Rating::Rate`.
|
||||
|
||||
## v0.9.0
|
||||
|
||||
### News
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
rating (0.9.0)
|
||||
rating (0.10.0)
|
||||
activerecord
|
||||
|
||||
GEM
|
||||
|
|
16
README.md
16
README.md
|
@ -406,6 +406,22 @@ 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`.
|
||||
|
||||
### where
|
||||
|
||||
The `where` option can be used to filter the `Rating::Rate` records used to create the final `Rating::Rating`. You can filter only approved rates, for exemplo:
|
||||
|
||||
```ruby
|
||||
rating where: 'approved = true'
|
||||
|
||||
author = User.last
|
||||
resource = Article.last
|
||||
|
||||
author.rate resource, 1, extra_scope: { approved: false }
|
||||
author.rate resource, 5, extra_scope: { approved: true }
|
||||
```
|
||||
|
||||
As you can see, now, only the rate with value `5` will be included on the final rating.
|
||||
|
||||
### References
|
||||
|
||||
- [Evan Miller](http://www.evanmiller.org/ranking-items-with-star-ratings.html)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Rating
|
||||
VERSION = '0.9.0'
|
||||
VERSION = '0.10.0'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue