counter_culture 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c76907944f824031e31fcc691b102507788efae1
4
- data.tar.gz: 284f75c98c1fdc54a9184abdeb4bef21966eb87f
3
+ metadata.gz: 5355b1fef2ee6bc80493e05f067a467e2aee9655
4
+ data.tar.gz: d17dc9165689f705528785d33a4f9b42c35f1314
5
5
  SHA512:
6
- metadata.gz: 43598278f71d3711c3c767c89bdf766b2c9388ed32f81900b7f934d705df7ba5f7c53e4cde6fe2401528fda002036133a6123cd27e0ffbed6f8846f2801e89ab
7
- data.tar.gz: 1f42db9e571e7939c139ca6e8d591e9a8430e8512cb831942edb6e0612637f4b23ca027b9320f017ac9531d8702a183554878e028b00de24d8c4701d32a2007d
6
+ metadata.gz: 18becb6b285ee801e83659721a214444c5a5e3c52cee77d310432a1e52b68a0de4373afe0c4f5854c469c6d431cf03b4ee2f510c4aa5190fe076ab1b2f2b7039
7
+ data.tar.gz: 09015b5df2ef84c6fb5c42e6316f6016e654586cf4b860be199384bb03db370ff0cdf4c5e1c0d1f01b51fcf8405f135ab5324d8bf4ca04b161a9a585c920b1de
@@ -1,3 +1,8 @@
1
+ ## 0.1.33 (April 2, 2015)
2
+
3
+ Bugfixes:
4
+ - Fixes an issue with STI classes and inheritance
5
+
1
6
  ## 0.1.32 (March 16, 2015)
2
7
 
3
8
  Improvements:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.32
1
+ 0.1.33
@@ -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 0.1.32 ruby lib
5
+ # stub: counter_culture 0.1.33 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "counter_culture"
9
- s.version = "0.1.32"
9
+ s.version = "0.1.33"
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 = "2015-03-17"
14
+ s.date = "2015-04-02"
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 = [
@@ -52,6 +52,7 @@ Gem::Specification.new do |s|
52
52
  "spec/models/review.rb",
53
53
  "spec/models/simple_dependent.rb",
54
54
  "spec/models/simple_main.rb",
55
+ "spec/models/simple_review.rb",
55
56
  "spec/models/subcateg.rb",
56
57
  "spec/models/twitter_review.rb",
57
58
  "spec/models/user.rb",
@@ -108,7 +109,7 @@ Gem::Specification.new do |s|
108
109
  ]
109
110
  s.homepage = "http://github.com/bestvendor/counter_culture"
110
111
  s.licenses = ["MIT"]
111
- s.rubygems_version = "2.4.3"
112
+ s.rubygems_version = "2.2.2"
112
113
  s.summary = "Turbo-charged counter caches for your Rails app."
113
114
 
114
115
  if s.respond_to? :specification_version then
@@ -13,7 +13,13 @@ module CounterCulture
13
13
 
14
14
  module ClassMethods
15
15
  # this holds all configuration data
16
- attr_reader :after_commit_counter_cache
16
+ def after_commit_counter_cache
17
+ config = @after_commit_counter_cache || []
18
+ if superclass.respond_to?(:after_commit_counter_cache) && superclass.after_commit_counter_cache
19
+ config = superclass.after_commit_counter_cache + config
20
+ end
21
+ config
22
+ end
17
23
 
18
24
  # called to configure counter caches
19
25
  def counter_culture(relation, options = {})
@@ -4,6 +4,7 @@ require 'models/company'
4
4
  require 'models/industry'
5
5
  require 'models/product'
6
6
  require 'models/review'
7
+ require 'models/simple_review'
7
8
  require 'models/twitter_review'
8
9
  require 'models/user'
9
10
  require 'models/category'
@@ -936,7 +937,7 @@ describe "CounterCulture" do
936
937
  company.save!
937
938
  product.save!
938
939
 
939
- TwitterReview.counter_culture_fix_counts
940
+ TwitterReview.counter_culture_fix_counts :skip_unsupported => true
940
941
 
941
942
  company.reload
942
943
  product.reload
@@ -945,6 +946,21 @@ describe "CounterCulture" do
945
946
  product.twitter_reviews_count.should == 1
946
947
  end
947
948
 
949
+ it "handles an inherited STI counter cache correctly" do
950
+ company = Company.create
951
+ user = User.create :manages_company_id => company.id
952
+ product = Product.create
953
+ SimpleReview.create :user_id => user.id, :product_id => product.id
954
+ product.reload
955
+ product.reviews_count.should == 1
956
+ product.simple_reviews_count.should == 1
957
+
958
+ Review.create :user_id => user.id, :product_id => product.id
959
+ product.reload
960
+ product.reviews_count.should == 2
961
+ product.simple_reviews_count.should == 1
962
+ end
963
+
948
964
  it "should fix a second-level counter cache correctly" do
949
965
  company = Company.create
950
966
  user = User.create :manages_company_id => company.id
@@ -0,0 +1,3 @@
1
+ class SimpleReview < Review
2
+ counter_culture :product
3
+ end
@@ -41,8 +41,9 @@ ActiveRecord::Schema.define(:version => 20120522160158) do
41
41
 
42
42
  create_table "products", :force => true do |t|
43
43
  t.string "name"
44
- t.integer "reviews_count", :default => 0, :null => false
45
- t.integer "rexiews_count", :default => 0, :null => false
44
+ t.integer "reviews_count", :default => 0, :null => false
45
+ t.integer "simple_reviews_count", :default => 0, :null => false
46
+ t.integer "rexiews_count", :default => 0, :null => false
46
47
  t.integer "twitter_reviews_count", :default => 0, :null => false
47
48
  t.integer "category_id"
48
49
  t.datetime "created_at"
@@ -19,4 +19,6 @@ ActiveRecord::Base.logger.level = 1
19
19
 
20
20
  RSpec.configure do |config|
21
21
  config.fail_fast = true
22
+ config.filter_run focus: true
23
+ config.run_all_when_everything_filtered = true
22
24
  end
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: 0.1.32
4
+ version: 0.1.33
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: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: after_commit_action
@@ -194,6 +194,7 @@ files:
194
194
  - spec/models/review.rb
195
195
  - spec/models/simple_dependent.rb
196
196
  - spec/models/simple_main.rb
197
+ - spec/models/simple_review.rb
197
198
  - spec/models/subcateg.rb
198
199
  - spec/models/twitter_review.rb
199
200
  - spec/models/user.rb
@@ -267,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
268
  version: '0'
268
269
  requirements: []
269
270
  rubyforge_project:
270
- rubygems_version: 2.4.3
271
+ rubygems_version: 2.2.2
271
272
  signing_key:
272
273
  specification_version: 4
273
274
  summary: Turbo-charged counter caches for your Rails app.