counter_culture 1.8.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/counter_culture.gemspec +3 -3
- data/lib/generators/counter_culture_generator.rb +7 -1
- data/lib/generators/templates/counter_culture_migration.rb.erb +6 -12
- data/spec/counter_culture_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf58d3caa98a0fbb9741d974f746a6071a7a28e9
|
4
|
+
data.tar.gz: 38e56a66e6e995ab3df7d9cc0ece39f58bc408b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e301243129495b31dc32759c6757aa16ab553f829ebe762e317ff3a59657b62cf9f102b3dbde939e3259c2dd3958fae0eeae9632e53f684bdbe334ba89f16d58
|
7
|
+
data.tar.gz: 4d54dfeb834c6c81d754665f7fb0250c050b4ca8509da255a3546605f91dd5c51ac78ca271af80fd9ecc77e4782878d23375f010b132ecdd2965429d9a2cea37
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -116,7 +116,7 @@ end
|
|
116
116
|
```ruby
|
117
117
|
class Product < ActiveRecord::Base
|
118
118
|
belongs_to :category
|
119
|
-
counter_culture :category, column_name: :weight, delta_magnitude: proc { model.product_type == 'awesome' ? 2 : 1 }
|
119
|
+
counter_culture :category, column_name: :weight, delta_magnitude: proc {|model| model.product_type == 'awesome' ? 2 : 1 }
|
120
120
|
end
|
121
121
|
|
122
122
|
class Category < ActiveRecord::Base
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.9.0
|
data/counter_culture.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: counter_culture 1.
|
5
|
+
# stub: counter_culture 1.9.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "counter_culture"
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.9.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Magnus von Koeller"]
|
14
|
-
s.date = "2017-
|
14
|
+
s.date = "2017-11-29"
|
15
15
|
s.description = "counter_culture provides turbo-charged counter caches that are kept up-to-date not just on create and destroy, that support multiple levels of indirection through relationships, allow dynamic column names and that avoid deadlocks by updating in the after_commit callback."
|
16
16
|
s.email = "magnus@vonkoeller.de"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -11,7 +11,7 @@ class CounterCultureGenerator < ActiveRecord::Generators::Base
|
|
11
11
|
source_root File.expand_path("../templates", __FILE__)
|
12
12
|
|
13
13
|
def generate_migration
|
14
|
-
migration_template "counter_culture_migration.rb.erb", "db/migrate/#{migration_file_name}"
|
14
|
+
migration_template "counter_culture_migration.rb.erb", "db/migrate/#{migration_file_name}", migration_version: migration_version
|
15
15
|
end
|
16
16
|
|
17
17
|
def migration_name
|
@@ -26,4 +26,10 @@ class CounterCultureGenerator < ActiveRecord::Generators::Base
|
|
26
26
|
migration_name.camelize
|
27
27
|
end
|
28
28
|
|
29
|
+
def migration_version
|
30
|
+
if Rails.version.start_with? '5.'
|
31
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
29
35
|
end
|
@@ -1,15 +1,9 @@
|
|
1
|
-
class <%= migration_class_name %> < ActiveRecord::Migration
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def self.up<% counter_cache_columns.each do |column| %>
|
3
|
+
add_column :<%= table_name %>, :<%= column %>, :integer, null: false, default: 0
|
4
|
+
<% end %> end
|
2
5
|
|
3
|
-
def self.
|
4
|
-
<% counter_cache_columns.each do |column| %>
|
5
|
-
add_column :<%= table_name %>, :<%= column %>, :integer, :null => false, :default => 0
|
6
|
-
<% end %>
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
<% counter_cache_columns.each do |column| %>
|
6
|
+
def self.down<% counter_cache_columns.each do |column| %>
|
11
7
|
remove_column :<%= table_name %>, :<%= column %>
|
12
|
-
<% end %>
|
13
|
-
end
|
14
|
-
|
8
|
+
<% end %> end
|
15
9
|
end
|
@@ -1644,6 +1644,7 @@ describe "CounterCulture" do
|
|
1644
1644
|
|
1645
1645
|
describe "when using acts_as_paranoia" do
|
1646
1646
|
it "works" do
|
1647
|
+
skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
|
1647
1648
|
company = Company.create!
|
1648
1649
|
expect(company.soft_deletes_count).to eq(0)
|
1649
1650
|
sd = SoftDelete.create!(company_id: company.id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: counter_culture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus von Koeller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: after_commit_action
|