Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wbotelhos committed Feb 14, 2018
1 parent 719a603 commit 54980ec
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rating (0.4.0)
rating (0.5.0)
activerecord (>= 4.2, < 6)

GEM
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,32 @@ rate.fingerprint # <Fingerprint id:...>
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! (:
2 changes: 1 addition & 1 deletion lib/rating/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Rating
VERSION = '0.4.0'
VERSION = '0.5.0'
end

0 comments on commit 54980ec

Please sign in to comment.