counter_culture 0.1.28 → 0.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/counter_culture.gemspec +3 -3
- data/lib/counter_culture.rb +1 -1
- data/spec/counter_culture_spec.rb +6 -0
- data/spec/models/twitter_review.rb +1 -0
- data/spec/schema.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: fc13eaf1a8b41c9d062ec7606dde7418321cb6b5
|
4
|
+
data.tar.gz: 948845a96cec14ec05ad067f56a0c460ab86ba21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b515bdc8f3032a0da0594f622f5b0176f68a9a99c2ef4eda7d846085388ef0919cc7abe49e031e8c8dafa52d949cd49feffa71cb9ed3d73fc00c248cf83bbff9
|
7
|
+
data.tar.gz: 0cd98b49e84f374bbb25ac631316f882beff7a78c7689caeceff70a5083da41924deaf5da317afe70328995ee6be59d82ae2b59eceddd8430c6080fac0c301f8
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.29
|
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 0.1.
|
5
|
+
# stub: counter_culture 0.1.29 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "counter_culture"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.29"
|
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 = "2014-12-
|
14
|
+
s.date = "2014-12-25"
|
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 = [
|
data/lib/counter_culture.rb
CHANGED
@@ -106,7 +106,7 @@ module CounterCulture
|
|
106
106
|
# join with alias to avoid ambiguous table name with self-referential models:
|
107
107
|
joins_query = "LEFT JOIN #{reflect.active_record.table_name} AS #{join_table_name} ON #{reflect.table_name}.#{reflect.klass.primary_key} = #{join_table_name}.#{reflect.foreign_key}"
|
108
108
|
# adds 'type' condition to JOIN clause if the current model is a child in a Single Table Inheritance
|
109
|
-
joins_query = "#{joins_query} AND #{reflect.active_record.table_name}.type IN ('#{self.name}')" if
|
109
|
+
joins_query = "#{joins_query} AND #{reflect.active_record.table_name}.type IN ('#{self.name}')" if reflect.active_record.column_names.include?('type') and not(self.descends_from_active_record?)
|
110
110
|
joins_query
|
111
111
|
end
|
112
112
|
|
@@ -876,6 +876,7 @@ describe "CounterCulture" do
|
|
876
876
|
user = User.create :manages_company_id => company.id
|
877
877
|
product = Product.create
|
878
878
|
|
879
|
+
company.twitter_reviews_count.should == 0
|
879
880
|
product.twitter_reviews_count.should == 0
|
880
881
|
|
881
882
|
review = Review.create :user_id => user.id, :product_id => product.id, :approvals => 42
|
@@ -885,15 +886,20 @@ describe "CounterCulture" do
|
|
885
886
|
user.reload
|
886
887
|
product.reload
|
887
888
|
|
889
|
+
company.twitter_reviews_count.should == 1
|
888
890
|
product.twitter_reviews_count.should == 1
|
889
891
|
|
892
|
+
company.twitter_reviews_count = 2
|
890
893
|
product.twitter_reviews_count = 2
|
894
|
+
company.save!
|
891
895
|
product.save!
|
892
896
|
|
893
897
|
TwitterReview.counter_culture_fix_counts
|
894
898
|
|
899
|
+
company.reload
|
895
900
|
product.reload
|
896
901
|
|
902
|
+
company.twitter_reviews_count.should == 1
|
897
903
|
product.twitter_reviews_count.should == 1
|
898
904
|
end
|
899
905
|
|
data/spec/schema.rb
CHANGED
@@ -17,6 +17,7 @@ ActiveRecord::Schema.define(:version => 20120522160158) do
|
|
17
17
|
t.string "name"
|
18
18
|
t.integer "industry_id"
|
19
19
|
t.integer "reviews_count", :default => 0, :null => false
|
20
|
+
t.integer "twitter_reviews_count", :default => 0, :null => false
|
20
21
|
t.integer "using_count", :default => 0, :null => false
|
21
22
|
t.integer "tried_count", :default => 0, :null => false
|
22
23
|
t.integer "managers_count", :default => 0, :null => false
|
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.
|
4
|
+
version: 0.1.29
|
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: 2014-12-
|
11
|
+
date: 2014-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: after_commit_action
|