Skip to content

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wbotelhos committed Mar 5, 2018
1 parent 9debad6 commit c7ce1d2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

### News
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rating (0.7.0)
rating (0.8.0)
activerecord (>= 4.2, < 6)

GEM
Expand Down Expand Up @@ -40,7 +40,7 @@ GEM
crass (1.0.3)
database_cleaner (1.6.2)
diff-lcs (1.3)
erubi (1.7.0)
erubi (1.7.1)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_bot_rails (4.8.2)
Expand Down Expand Up @@ -100,9 +100,9 @@ GEM
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubocop (0.52.1)
rubocop (0.53.0)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,24 @@ rating:
- 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!

Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=rating) or [Patreon](https://www.patreon.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.7.0'
VERSION = '0.8.0'
end

0 comments on commit c7ce1d2

Please sign in to comment.