acts_as_votable 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +10 -1
- data/Appraisals +6 -1
- data/README.md +5 -2
- data/gemfiles/rails_7_0.gemfile +8 -0
- data/lib/acts_as_votable/extenders/votable.rb +0 -1
- data/lib/acts_as_votable/extenders/voter.rb +0 -1
- data/lib/acts_as_votable/extenders.rb +11 -0
- data/lib/acts_as_votable/helpers.rb +9 -0
- data/lib/acts_as_votable/version.rb +1 -1
- data/lib/acts_as_votable/votable.rb +0 -1
- data/lib/acts_as_votable.rb +10 -4
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716790eb29b78931fcc52052c68a260036354513ee02850f06fc4460812b2b0a
|
4
|
+
data.tar.gz: 06e8af46b169792a3f218666ef9ee73d41e781baae2c88a5ed0202aa151d9043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 476384079c94b60160d19ececbc96aedd83a0b4cadbc7b17662cf630cd2cbcfaaed9c616a74a3e5e10a93c0ec692437628fe967c8712d1e39ee8282b3b210dc5
|
7
|
+
data.tar.gz: 84989f2e628bfb60a07e07696a903b383cc07f372ac9780c597dc56d7d64721f98fbf20d1d4f44106fc77463d9e52713254d624df5bea2da378ff76f66a7d633
|
data/.github/workflows/main.yml
CHANGED
@@ -25,6 +25,15 @@ jobs:
|
|
25
25
|
- gemfiles/rails_6_1.gemfile
|
26
26
|
continue-on-error:
|
27
27
|
- false
|
28
|
+
include:
|
29
|
+
- ruby: "3.0"
|
30
|
+
gemfile: gemfiles/rails_6_1.gemfile
|
31
|
+
os: ubuntu
|
32
|
+
continue-on-error: false
|
33
|
+
- ruby: 3.1
|
34
|
+
gemfile: gemfiles/rails_7_0.gemfile
|
35
|
+
os: ubuntu
|
36
|
+
continue-on-error: false
|
28
37
|
|
29
38
|
env:
|
30
39
|
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
@@ -41,4 +50,4 @@ jobs:
|
|
41
50
|
- name: Test
|
42
51
|
run: bundle exec rake spec
|
43
52
|
|
44
|
-
# use this
|
53
|
+
# use this
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -95,12 +95,12 @@ Revisiting the previous example of code.
|
|
95
95
|
|
96
96
|
# tally them up!
|
97
97
|
@post.votes_for.size # => 5
|
98
|
-
@post.weighted_total => 5
|
98
|
+
@post.weighted_total # => 5
|
99
99
|
@post.get_likes.size # => 3
|
100
100
|
@post.get_upvotes.size # => 3
|
101
101
|
@post.get_dislikes.size # => 2
|
102
102
|
@post.get_downvotes.size # => 2
|
103
|
-
@post.weighted_score => 1
|
103
|
+
@post.weighted_score # => 1
|
104
104
|
```
|
105
105
|
|
106
106
|
Active Record scopes are provided to make life easier.
|
@@ -342,6 +342,9 @@ class AddCachedVotesToPosts < ActiveRecord::Migration
|
|
342
342
|
t.integer :cached_weighted_subscribe_score, default: 0
|
343
343
|
t.integer :cached_weighted_subscribe_total, default: 0
|
344
344
|
t.float :cached_weighted_subscribe_average, default: 0.0
|
345
|
+
|
346
|
+
# Uncomment this line to force caching of existing scoped votes
|
347
|
+
# Post.find_each { |p| p.update_cached_votes("subscribe") }
|
345
348
|
end
|
346
349
|
end
|
347
350
|
end
|
data/lib/acts_as_votable.rb
CHANGED
@@ -2,20 +2,26 @@
|
|
2
2
|
|
3
3
|
require "active_record"
|
4
4
|
require "active_support/inflector"
|
5
|
+
require "active_support/dependencies/autoload"
|
5
6
|
|
6
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
8
|
|
8
9
|
module ActsAsVotable
|
10
|
+
extend ActiveSupport::Autoload
|
11
|
+
|
12
|
+
autoload :Votable
|
13
|
+
autoload :Vote
|
14
|
+
autoload :Voter
|
15
|
+
autoload :Cacheable
|
16
|
+
autoload :Extenders
|
17
|
+
autoload :Helpers
|
18
|
+
|
9
19
|
if defined?(ActiveRecord::Base)
|
10
|
-
require "acts_as_votable/extenders/votable"
|
11
|
-
require "acts_as_votable/extenders/voter"
|
12
|
-
require "acts_as_votable/vote"
|
13
20
|
ActiveRecord::Base.extend ActsAsVotable::Extenders::Votable
|
14
21
|
ActiveRecord::Base.extend ActsAsVotable::Extenders::Voter
|
15
22
|
end
|
16
23
|
end
|
17
24
|
|
18
|
-
require "acts_as_votable/extenders/controller"
|
19
25
|
ActiveSupport.on_load(:action_controller) do
|
20
26
|
include ActsAsVotable::Extenders::Controller
|
21
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_votable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -118,11 +118,14 @@ files:
|
|
118
118
|
- gemfiles/rails_6.gemfile
|
119
119
|
- gemfiles/rails_6_1.gemfile
|
120
120
|
- gemfiles/rails_6_rc1.gemfile
|
121
|
+
- gemfiles/rails_7_0.gemfile
|
121
122
|
- lib/acts_as_votable.rb
|
122
123
|
- lib/acts_as_votable/cacheable.rb
|
124
|
+
- lib/acts_as_votable/extenders.rb
|
123
125
|
- lib/acts_as_votable/extenders/controller.rb
|
124
126
|
- lib/acts_as_votable/extenders/votable.rb
|
125
127
|
- lib/acts_as_votable/extenders/voter.rb
|
128
|
+
- lib/acts_as_votable/helpers.rb
|
126
129
|
- lib/acts_as_votable/helpers/words.rb
|
127
130
|
- lib/acts_as_votable/version.rb
|
128
131
|
- lib/acts_as_votable/votable.rb
|
@@ -152,7 +155,7 @@ homepage: http://rubygems.org/gems/acts_as_votable
|
|
152
155
|
licenses:
|
153
156
|
- MIT
|
154
157
|
metadata: {}
|
155
|
-
post_install_message:
|
158
|
+
post_install_message:
|
156
159
|
rdoc_options: []
|
157
160
|
require_paths:
|
158
161
|
- lib
|
@@ -167,8 +170,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
170
|
- !ruby/object:Gem::Version
|
168
171
|
version: '0'
|
169
172
|
requirements: []
|
170
|
-
|
171
|
-
|
173
|
+
rubyforge_project:
|
174
|
+
rubygems_version: 2.7.6
|
175
|
+
signing_key:
|
172
176
|
specification_version: 4
|
173
177
|
summary: Rails gem to allowing records to be votable
|
174
178
|
test_files:
|