From 54980ec054f6e34eb57be8a1a0ac824f78b652f1 Mon Sep 17 00:00:00 2001 From: Washington Botelho Date: Wed, 14 Feb 2018 15:38:04 -0200 Subject: [PATCH] v0.5.0 --- CHANGELOG.md | 11 +++++++++++ Gemfile.lock | 2 +- README.md | 26 ++++++++++++++++++++++++++ lib/rating/version.rb | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5341cc..342d281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ### News diff --git a/Gemfile.lock b/Gemfile.lock index 70c6e67..f190d70 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rating (0.4.0) + rating (0.5.0) activerecord (>= 4.2, < 6) GEM diff --git a/README.md b/README.md index 69fe9dd..5a0a6b4 100644 --- a/README.md +++ b/README.md @@ -321,6 +321,32 @@ rate.fingerprint # 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! Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=rating) or [Support](https://liberapay.com/wbotelhos). Thanks! (: diff --git a/lib/rating/version.rb b/lib/rating/version.rb index 9504224..6a2888f 100644 --- a/lib/rating/version.rb +++ b/lib/rating/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Rating - VERSION = '0.4.0' + VERSION = '0.5.0' end