acts_as_votable 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/README.md +2 -2
- data/acts_as_votable.gemspec +1 -3
- data/lib/acts_as_votable/extenders/votable.rb +2 -2
- data/lib/acts_as_votable/version.rb +1 -1
- data/lib/generators/acts_as_votable/migration/migration_generator.rb +6 -0
- data/spec/factories/votable_cache_update_attributes.rb +1 -1
- data/spec/shared_example/votable_model.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2009307e736be800daee0e8ee1ab174eaf9d0bcf
|
4
|
+
data.tar.gz: 1a1bd0c1391488334ca8509fb8a18d6e95bcfb88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0882bea0b7292e43280c383002f2955ad8fc254a8afd838d1525d5a4bb0afe76774a1c104dd8448bb82099d086b4b668c19323f9e0bba6d19a91ecd8556987ad'
|
7
|
+
data.tar.gz: 26cb45e05dce7f060a69fded4c613daf51d6090cacf4c0dab62d2d97cf7d594f0fb128000c34994205a02369369bc767b7277863ee59b6bc2bee2d0a6e1807ca
|
data/.travis.yml
CHANGED
@@ -9,10 +9,13 @@ rvm:
|
|
9
9
|
|
10
10
|
before_install:
|
11
11
|
- gem update --system
|
12
|
+
# Stay on Bundler 1.x (for dependency reasons as we want to support Rails 4.2.x and Ruby 2.3.x)
|
13
|
+
# More info here: https://docs.travis-ci.com/user/languages/ruby/#bundler-20
|
14
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
15
|
+
- gem install bundler -v '< 2'
|
12
16
|
|
13
17
|
gemfile:
|
14
18
|
- gemfiles/rails_4.gemfile
|
15
19
|
- gemfiles/rails_5.gemfile
|
16
20
|
- gemfiles/rails_5_1.gemfile
|
17
21
|
- gemfiles/rails_5_2.gemfile
|
18
|
-
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Acts As Votable (aka Acts As Likeable)
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/ryanto/acts_as_votable.svg?branch=master)](https://travis-ci.org/ryanto/acts_as_votable)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/ryanto/acts_as_votable.
|
4
|
+
[![Code Climate](https://codeclimate.com/github/ryanto/acts_as_votable.svg)](https://codeclimate.com/github/ryanto/acts_as_votable)
|
5
5
|
|
6
6
|
Acts As Votable is a Ruby Gem specifically written for Rails/ActiveRecord models.
|
7
7
|
The main goals of this gem are:
|
@@ -365,7 +365,7 @@ Display average rating:
|
|
365
365
|
You can control whether `updated_at` column of votable model will be touched or
|
366
366
|
not by passing `cacheable_strategy` option to `acts_as_votable` method.
|
367
367
|
|
368
|
-
By default, `
|
368
|
+
By default, `update` strategy is used. Pass `:update_columns` as
|
369
369
|
`cacheable_strategy` if you don't want to touch model's `updated_at` column.
|
370
370
|
```ruby
|
371
371
|
class Post < ActiveRecord::Base
|
data/acts_as_votable.gemspec
CHANGED
@@ -15,15 +15,13 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.description = "Rails gem to allowing records to be votable"
|
16
16
|
s.license = "MIT"
|
17
17
|
|
18
|
-
s.rubyforge_project = "acts_as_votable"
|
19
|
-
|
20
18
|
s.files = `git ls-files`.split("\n")
|
21
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
23
21
|
s.require_paths = ["lib"]
|
24
22
|
|
25
23
|
s.add_development_dependency "rspec", "~> 3.6"
|
26
|
-
s.add_development_dependency "sqlite3", "~> 1.3"
|
24
|
+
s.add_development_dependency "sqlite3", "~> 1.3.6"
|
27
25
|
s.add_development_dependency "rubocop", "~> 0.49.1"
|
28
26
|
s.add_development_dependency "simplecov", "~> 0.15.0"
|
29
27
|
s.add_development_dependency "appraisal", "~> 2.2"
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module ActsAsVotable
|
4
4
|
module Extenders
|
5
5
|
module Votable
|
6
|
-
ALLOWED_CACHEABLE_STRATEGIES = %i[
|
6
|
+
ALLOWED_CACHEABLE_STRATEGIES = %i[update update_columns]
|
7
7
|
|
8
8
|
def votable?
|
9
9
|
false
|
@@ -23,7 +23,7 @@ module ActsAsVotable
|
|
23
23
|
|
24
24
|
class_eval do
|
25
25
|
@acts_as_votable_options = {
|
26
|
-
cacheable_strategy: :
|
26
|
+
cacheable_strategy: :update
|
27
27
|
}.merge(args)
|
28
28
|
|
29
29
|
def self.votable?
|
@@ -36,11 +36,17 @@ module ActsAsVotable
|
|
36
36
|
def migration_version
|
37
37
|
if rails5?
|
38
38
|
"[4.2]"
|
39
|
+
elsif rails6?
|
40
|
+
"[6.0]"
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
def rails5?
|
43
45
|
Rails.version.start_with? "5"
|
44
46
|
end
|
47
|
+
|
48
|
+
def rails6?
|
49
|
+
Rails.version.start_with? "6"
|
50
|
+
end
|
45
51
|
end
|
46
52
|
end
|
@@ -411,8 +411,8 @@ shared_examples "a votable_model" do
|
|
411
411
|
|
412
412
|
before { votable_cache.vote_by voter: voter }
|
413
413
|
|
414
|
-
context "
|
415
|
-
let(:votable_cache) { create(:
|
414
|
+
context "update" do
|
415
|
+
let(:votable_cache) { create(:votable_cache_update, name: "voting model with cache", updated_at: updated_at) }
|
416
416
|
|
417
417
|
it do
|
418
418
|
expect(votable_cache.cached_votes_total).to eq(1)
|
data/spec/spec_helper.rb
CHANGED
@@ -124,8 +124,8 @@ class VotableCache < ActiveRecord::Base
|
|
124
124
|
validates_presence_of :name
|
125
125
|
end
|
126
126
|
|
127
|
-
class
|
128
|
-
acts_as_votable cacheable_strategy: :
|
127
|
+
class VotableCacheUpdate < VotableCache
|
128
|
+
acts_as_votable cacheable_strategy: :update
|
129
129
|
end
|
130
130
|
|
131
131
|
class VotableCacheUpdateColumns < VotableCache
|
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.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.3.6
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.3.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,8 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
|
-
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.6.14
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Rails gem to allowing records to be votable
|