counter_culture 0.1.33 → 0.1.34

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: 5355b1fef2ee6bc80493e05f067a467e2aee9655
4
- data.tar.gz: d17dc9165689f705528785d33a4f9b42c35f1314
3
+ metadata.gz: dc367bb995eff4a72895a3a77c93d1e9f97d8daf
4
+ data.tar.gz: 620b7a24d42f57468189b4ee20564dd90b2d3359
5
5
  SHA512:
6
- metadata.gz: 18becb6b285ee801e83659721a214444c5a5e3c52cee77d310432a1e52b68a0de4373afe0c4f5854c469c6d431cf03b4ee2f510c4aa5190fe076ab1b2f2b7039
7
- data.tar.gz: 09015b5df2ef84c6fb5c42e6316f6016e654586cf4b860be199384bb03db370ff0cdf4c5e1c0d1f01b51fcf8405f135ab5324d8bf4ca04b161a9a585c920b1de
6
+ metadata.gz: 27145d4edfdec7427e00624849adb265ce80bcb290f5936fcc521e4ac432bcb9c9300a127650cbb272d2445f6da6c7bb3fd20a442cfb2de1ed914aafa44b79c8
7
+ data.tar.gz: 3edc8b398be0a698225a11ce418434578e61f9e40c35a2c4a7e8643f56533339d1c356c34fa3eb4c752ad4da2d4e9e9067c5e15e1658907bf48eb3fc35926834
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.34 (October 27, 2015)
2
+
3
+ Bugfixes:
4
+ - Fixes an issue when using a default scope that adds a join in conjunction with counter_culture
5
+
1
6
  ## 0.1.33 (April 2, 2015)
2
7
 
3
8
  Bugfixes:
data/Gemfile.lock CHANGED
@@ -1,59 +1,69 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- actionmailer (4.1.7)
5
- actionpack (= 4.1.7)
6
- actionview (= 4.1.7)
4
+ actionmailer (4.2.4)
5
+ actionpack (= 4.2.4)
6
+ actionview (= 4.2.4)
7
+ activejob (= 4.2.4)
7
8
  mail (~> 2.5, >= 2.5.4)
8
- actionpack (4.1.7)
9
- actionview (= 4.1.7)
10
- activesupport (= 4.1.7)
11
- rack (~> 1.5.2)
9
+ rails-dom-testing (~> 1.0, >= 1.0.5)
10
+ actionpack (4.2.4)
11
+ actionview (= 4.2.4)
12
+ activesupport (= 4.2.4)
13
+ rack (~> 1.6)
12
14
  rack-test (~> 0.6.2)
13
- actionview (4.1.7)
14
- activesupport (= 4.1.7)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (4.2.4)
18
+ activesupport (= 4.2.4)
15
19
  builder (~> 3.1)
16
20
  erubis (~> 2.7.0)
17
- activemodel (4.1.7)
18
- activesupport (= 4.1.7)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ activejob (4.2.4)
24
+ activesupport (= 4.2.4)
25
+ globalid (>= 0.3.0)
26
+ activemodel (4.2.4)
27
+ activesupport (= 4.2.4)
19
28
  builder (~> 3.1)
20
- activerecord (4.1.7)
21
- activemodel (= 4.1.7)
22
- activesupport (= 4.1.7)
23
- arel (~> 5.0.0)
24
- activesupport (4.1.7)
25
- i18n (~> 0.6, >= 0.6.9)
29
+ activerecord (4.2.4)
30
+ activemodel (= 4.2.4)
31
+ activesupport (= 4.2.4)
32
+ arel (~> 6.0)
33
+ activesupport (4.2.4)
34
+ i18n (~> 0.7)
26
35
  json (~> 1.7, >= 1.7.7)
27
36
  minitest (~> 5.1)
28
- thread_safe (~> 0.1)
37
+ thread_safe (~> 0.3, >= 0.3.4)
29
38
  tzinfo (~> 1.1)
30
- addressable (2.3.6)
39
+ addressable (2.3.8)
31
40
  after_commit_action (1.0.0)
32
41
  activerecord (>= 3.0.0)
33
42
  activesupport (>= 3.0.0)
34
- arel (5.0.1.20140414130214)
35
- awesome_print (1.2.0)
43
+ arel (6.0.3)
44
+ awesome_print (1.6.1)
36
45
  builder (3.2.2)
37
- database_cleaner (1.3.0)
46
+ database_cleaner (1.5.1)
38
47
  descendants_tracker (0.0.4)
39
48
  thread_safe (~> 0.3, >= 0.3.1)
40
49
  diff-lcs (1.1.3)
41
50
  erubis (2.7.0)
42
- faraday (0.9.0)
51
+ faraday (0.9.2)
43
52
  multipart-post (>= 1.2, < 3)
44
- git (1.2.8)
45
- github_api (0.12.2)
53
+ git (1.2.9.1)
54
+ github_api (0.12.4)
46
55
  addressable (~> 2.3)
47
56
  descendants_tracker (~> 0.0.4)
48
57
  faraday (~> 0.8, < 0.10)
49
- hashie (>= 3.3)
58
+ hashie (>= 3.4)
50
59
  multi_json (>= 1.7.5, < 2.0)
51
- nokogiri (~> 1.6.3)
60
+ nokogiri (~> 1.6.6)
52
61
  oauth2
53
- hashie (3.3.1)
54
- highline (1.6.21)
55
- hike (1.2.3)
56
- i18n (0.6.11)
62
+ globalid (0.3.6)
63
+ activesupport (>= 4.1.0)
64
+ hashie (3.4.3)
65
+ highline (1.7.8)
66
+ i18n (0.7.0)
57
67
  jeweler (2.0.1)
58
68
  builder
59
69
  bundler (>= 1.0)
@@ -63,17 +73,19 @@ GEM
63
73
  nokogiri (>= 1.5.10)
64
74
  rake
65
75
  rdoc
66
- json (1.8.1)
67
- jwt (1.0.0)
76
+ json (1.8.3)
77
+ jwt (1.5.1)
78
+ loofah (2.0.3)
79
+ nokogiri (>= 1.5.9)
68
80
  mail (2.6.3)
69
81
  mime-types (>= 1.16, < 3)
70
- mime-types (2.4.3)
71
- mini_portile (0.6.1)
72
- minitest (5.4.3)
73
- multi_json (1.10.1)
82
+ mime-types (2.6.2)
83
+ mini_portile (0.6.2)
84
+ minitest (5.8.2)
85
+ multi_json (1.11.2)
74
86
  multi_xml (0.5.5)
75
87
  multipart-post (2.0.0)
76
- nokogiri (1.6.4.1)
88
+ nokogiri (1.6.6.2)
77
89
  mini_portile (~> 0.6.0)
78
90
  oauth2 (1.0.0)
79
91
  faraday (>= 0.8, < 0.10)
@@ -81,25 +93,34 @@ GEM
81
93
  multi_json (~> 1.3)
82
94
  multi_xml (~> 0.5)
83
95
  rack (~> 1.2)
84
- rack (1.5.2)
85
- rack-test (0.6.2)
96
+ rack (1.6.4)
97
+ rack-test (0.6.3)
86
98
  rack (>= 1.0)
87
- rails (4.1.7)
88
- actionmailer (= 4.1.7)
89
- actionpack (= 4.1.7)
90
- actionview (= 4.1.7)
91
- activemodel (= 4.1.7)
92
- activerecord (= 4.1.7)
93
- activesupport (= 4.1.7)
99
+ rails (4.2.4)
100
+ actionmailer (= 4.2.4)
101
+ actionpack (= 4.2.4)
102
+ actionview (= 4.2.4)
103
+ activejob (= 4.2.4)
104
+ activemodel (= 4.2.4)
105
+ activerecord (= 4.2.4)
106
+ activesupport (= 4.2.4)
94
107
  bundler (>= 1.3.0, < 2.0)
95
- railties (= 4.1.7)
96
- sprockets-rails (~> 2.0)
97
- railties (4.1.7)
98
- actionpack (= 4.1.7)
99
- activesupport (= 4.1.7)
108
+ railties (= 4.2.4)
109
+ sprockets-rails
110
+ rails-deprecated_sanitizer (1.0.3)
111
+ activesupport (>= 4.2.0.alpha)
112
+ rails-dom-testing (1.0.7)
113
+ activesupport (>= 4.2.0.beta, < 5.0)
114
+ nokogiri (~> 1.6.0)
115
+ rails-deprecated_sanitizer (>= 1.0.1)
116
+ rails-html-sanitizer (1.0.2)
117
+ loofah (~> 2.0)
118
+ railties (4.2.4)
119
+ actionpack (= 4.2.4)
120
+ activesupport (= 4.2.4)
100
121
  rake (>= 0.8.7)
101
122
  thor (>= 0.18.1, < 2.0)
102
- rake (10.3.2)
123
+ rake (10.4.2)
103
124
  rdoc (3.12.2)
104
125
  json (~> 1.4)
105
126
  rspec (2.10.0)
@@ -111,19 +132,15 @@ GEM
111
132
  diff-lcs (~> 1.1.3)
112
133
  rspec-extra-formatters (1.0.0)
113
134
  rspec-mocks (2.10.1)
114
- sprockets (2.12.3)
115
- hike (~> 1.2)
116
- multi_json (~> 1.0)
117
- rack (~> 1.0)
118
- tilt (~> 1.1, != 1.3.0)
119
- sprockets-rails (2.2.0)
135
+ sprockets (3.4.0)
136
+ rack (> 1, < 3)
137
+ sprockets-rails (2.3.3)
120
138
  actionpack (>= 3.0)
121
139
  activesupport (>= 3.0)
122
140
  sprockets (>= 2.8, < 4.0)
123
- sqlite3 (1.3.10)
141
+ sqlite3 (1.3.11)
124
142
  thor (0.19.1)
125
- thread_safe (0.3.4)
126
- tilt (1.4.1)
143
+ thread_safe (0.3.5)
127
144
  tzinfo (1.2.2)
128
145
  thread_safe (~> 0.1)
129
146
 
@@ -144,3 +161,6 @@ DEPENDENCIES
144
161
  rspec (~> 2.10.0)
145
162
  rspec-extra-formatters
146
163
  sqlite3
164
+
165
+ BUNDLED WITH
166
+ 1.10.6
data/README.md CHANGED
@@ -13,10 +13,10 @@ Turbo-charged counter caches for your Rails app. Huge improvements over the Rail
13
13
  Add counter_culture to your Gemfile:
14
14
 
15
15
  ```ruby
16
- gem 'counter_culture', '~> 0.1.23'
16
+ gem 'counter_culture', '~> 0.1.33'
17
17
  ```
18
18
 
19
- Then run ```bundle update ```
19
+ Then run `bundle install`
20
20
 
21
21
  ## Database Schema
22
22
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.33
1
+ 0.1.34
@@ -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.33 ruby lib
5
+ # stub: counter_culture 0.1.34 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "counter_culture"
9
- s.version = "0.1.33"
9
+ s.version = "0.1.34"
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-04-02"
14
+ s.date = "2015-10-27"
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 = [
@@ -109,7 +109,7 @@ Gem::Specification.new do |s|
109
109
  ]
110
110
  s.homepage = "http://github.com/bestvendor/counter_culture"
111
111
  s.licenses = ["MIT"]
112
- s.rubygems_version = "2.2.2"
112
+ s.rubygems_version = "2.2.5"
113
113
  s.summary = "Turbo-charged counter caches for your Rails app."
114
114
 
115
115
  if s.respond_to? :specification_version then
@@ -371,7 +371,8 @@ module CounterCulture
371
371
  if was
372
372
  first = relation.shift
373
373
  foreign_key_value = send("#{relation_foreign_key(first)}_was")
374
- value = relation_klass(first).where("#{relation_primary_key(first)} = ?", foreign_key_value).first if foreign_key_value
374
+ klass = relation_klass(first)
375
+ value = klass.where("#{klass.table_name}.#{relation_primary_key(first)} = ?", foreign_key_value).first if foreign_key_value
375
376
  else
376
377
  value = self
377
378
  end
@@ -454,6 +454,27 @@ describe "CounterCulture" do
454
454
  user.using_count.should == 0
455
455
  user.tried_count.should == 0
456
456
  end
457
+
458
+ it "should decrement if changing column name to nil without errors using default scope" do
459
+ User.with_default_scope do
460
+ user.using_count.should == 0
461
+ user.tried_count.should == 0
462
+
463
+ review = Review.create :user_id => user.id, :product_id => product.id, :review_type => "using"
464
+ user.reload
465
+
466
+ user.using_count.should == 1
467
+ user.tried_count.should == 0
468
+
469
+ review.review_type = nil
470
+ review.save!
471
+
472
+ user.reload
473
+
474
+ user.using_count.should == 0
475
+ user.tried_count.should == 0
476
+ end
477
+ end
457
478
  end
458
479
 
459
480
  it "increments third-level counter cache on create" do
data/spec/models/user.rb CHANGED
@@ -8,4 +8,22 @@ class User < ActiveRecord::Base
8
8
 
9
9
  has_many :reviews
10
10
  accepts_nested_attributes_for :reviews, :allow_destroy => true
11
+
12
+ default_scope do
13
+ if _default_scope_enabled
14
+ joins("LEFT OUTER JOIN companies").uniq
15
+ else
16
+ all
17
+ end
18
+ end
19
+
20
+ class << self
21
+ attr_accessor :_default_scope_enabled
22
+
23
+ def with_default_scope
24
+ @_default_scope_enabled = true
25
+ yield
26
+ @_default_scope_enabled = false
27
+ end
28
+ end
11
29
  end
@@ -49,5 +49,8 @@ module RailsApp
49
49
 
50
50
  # Version of your assets, change this if you want to expire all your assets
51
51
  config.assets.version = '1.0'
52
+
53
+ # Avoid deprecation warning
54
+ config.active_record.raise_in_transactional_callbacks = true
52
55
  end
53
56
  end
@@ -8,7 +8,7 @@ RailsApp::Application.configure do
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
11
+ config.serve_static_files = true
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
14
  # Show full error reports and disable caching
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.33
4
+ version: 0.1.34
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-04-02 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: after_commit_action
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  version: '0'
269
269
  requirements: []
270
270
  rubyforge_project:
271
- rubygems_version: 2.2.2
271
+ rubygems_version: 2.2.5
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Turbo-charged counter caches for your Rails app.