main
Washington Botelho 2018-02-14 15:38:04 -02:00
parent 719a6035d9
commit 54980ec054
No known key found for this signature in database
GPG Key ID: 5DE4F42A8F073617
4 changed files with 39 additions and 2 deletions

View File

@ -1,3 +1,14 @@
## v0.5.0
### News
- Adds `rating.yml` config to support to change the tables where Rating will write the data;
- Adds `scoping` option to support to generates zero based rating via scope.
### Updates
- The migrate was separated in two to improve in troubleshoot. (iondrimba)
## v0.4.0 ## v0.4.0
### News ### News

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
rating (0.4.0) rating (0.5.0)
activerecord (>= 4.2, < 6) activerecord (>= 4.2, < 6)
GEM GEM

View File

@ -321,6 +321,32 @@ rate.fingerprint # <Fingerprint id:...>
rate.value # 3 rate.value # 3
``` ```
### Scoping
If you need to warm up a record with scope, you need to setup the `scoping` relation.
```ruby
class Resource < ApplicationRecord
voting scoping: :categories
end
```
Now, when a resource is created, the cache will be generated for each related `category` as `scopeable`.
### Table Name
You can choose the table where Rating will write the data via YAML config.
You should just to provide a `config/rating.yml` file with the following content:
```yml
rating:
rate_table: 'reviews'
rating_table: 'review_ratings'
```
Now the rates will be written on `reviews` table over `rating_rates` and calculation will be on `review_ratings` over `rating_ratings`.
You can change one table o both of them.
## Love it! ## Love it!
Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=rating) or [Support](https://liberapay.com/wbotelhos). Thanks! (: Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=rating) or [Support](https://liberapay.com/wbotelhos). Thanks! (:

View File

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