custom_counter_cache 0.1.2 → 0.1.3

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: 6e5fc4d939f22ea47d554fccc9fc4a1d38bbfbd8
4
- data.tar.gz: 320ea9e7b270ae977f1baf59cb35a7a6a1e4f470
3
+ metadata.gz: 66fc160dfabec304e7ce5111f1c1a83e884ef36a
4
+ data.tar.gz: 55ad131d50a4c2e22d4badc976f95f98a712faea
5
5
  SHA512:
6
- metadata.gz: b7b67a4159f8266cd5a9dc6b46baebd5ac4cc06821fa93100dfc968d6cd52ff3020c93df3797a730ed08fe16866f21d4cc301d0eaaf9dc49b9f1594a173ea642
7
- data.tar.gz: 7906c1b7ed13b8c43870a1066279c3434e86c2104a761838ad74b0f97c592b347ef3eb236611e7c0adac2715a6f4ef3769dd3d3f203b44c8f1a9316a7792a181
6
+ metadata.gz: 02355008f524af7086e011d7bf16a0a00d47cef869af4d363aaee420535c82e9e2ede4c3ccd079b96ee8b990feb5ab94f02dc220717f81ad3676954054bc3c06
7
+ data.tar.gz: 20f6036a75d16e6c20ad0333de36e4dbbc8cfc4198689a6d5761827ab33e3697022daf71da156fa162a64b6817f8c697db6d0e7eef4c8fe25f0af7eba5555d06
@@ -17,11 +17,11 @@ module CustomCounterCache::Model
17
17
  if counters.loaded? && counter = counters.detect{|c| c.key == cache_column.to_s }
18
18
  counter.value
19
19
  else
20
- counters.where(:key => cache_column.to_s).first.try(:value).to_i
20
+ counters.find_by_key(cache_column.to_s).try(:value).to_i
21
21
  end
22
22
  end
23
23
  define_method "#{cache_column}=" do |count|
24
- if ( counter = counters.where(:key => cache_column.to_s).first )
24
+ if ( counter = counters.find_by_key(cache_column.to_s) )
25
25
  counter.update_attribute :value, count.to_i
26
26
  else
27
27
  counters.create :key => cache_column.to_s, :value => count.to_i
@@ -1,5 +1,5 @@
1
1
  module CustomCounterCache
2
2
 
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
 
5
5
  end
data/test/counter_test.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  require File.join(File.dirname(__FILE__), 'test_helper')
2
2
 
3
- class CounterTest < Test::Unit::TestCase
3
+ class CounterTest < MiniTest::Unit::TestCase
4
4
 
5
5
  def setup
6
6
  @user = User.create
7
7
  @box = Box.create
8
+ Counter.destroy_all
8
9
  end
9
10
 
10
11
  def test_default_counter_value
data/test/test_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
  require 'sqlite3'
4
4
  require 'action_view'
5
5
  require 'active_record'
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_counter_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cedric Howe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-05 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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
40
  version: '0'
41
41
  description: ''
@@ -44,9 +44,9 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - lib/custom_counter_cache.rb
47
48
  - lib/custom_counter_cache/model.rb
48
49
  - lib/custom_counter_cache/version.rb
49
- - lib/custom_counter_cache.rb
50
50
  - test/counter_test.rb
51
51
  - test/test_helper.rb
52
52
  homepage: http://github.com/cedric/custom_counter_cache/
@@ -59,17 +59,17 @@ require_paths:
59
59
  - lib
60
60
  required_ruby_version: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - '>='
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: 1.3.6
70
70
  requirements: []
71
71
  rubyforge_project: custom_counter_cache
72
- rubygems_version: 2.0.3
72
+ rubygems_version: 2.4.5
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: Custom counter_cache functionality that supports conditions and multiple