directiverecord 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDNjNWU1NTk0ZmM0MTViZDgyZDAxMmJkNmI5OWYwZTQ4MGUzNmIzZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDEwNjA5YmQ2ZTRkM2Q2ZjFjZDY3MGViYTE0ZTJmN2YyZDQyMzQxOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmE4ZjdjNzVhNzRhYjk4NjI5NjkzMzY0ZDQyZDE3OTAxMTM2YWVjODNmZDlm
|
10
|
+
NGRmN2RkMzBkMGFmZDUyMDc5ODk1YjlhNjUxNDU3NGU2NDE3YTFhNzkzZWRl
|
11
|
+
ZTkzNmE3YTJhODA0ZTIyMjBhZDY2OGI3ZmIxY2ZiZWYwOTUxY2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmNlNjkyZDE1NjRhZjI2NmZlNDk3MmM0M2IzYjJiZDUxY2ZhMjg3MWM0Mjc2
|
14
|
+
NjU4NjM0M2YwZWY3ZTY0MGZlZWRjN2VkN2M0ZjU0ZDBjOWVjYjdlY2NlMTE1
|
15
|
+
MDJjMWVmMmYwZDk1NTE0YTE4MDAwM2M0MDk3OTNiYzEyMDQ5MDc=
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= DirectiveRecord CHANGELOG
|
2
2
|
|
3
|
+
== Version 0.1.10 (March 5, 2015)
|
4
|
+
|
5
|
+
* Overridden ActiveRecord::Relation#count(:all) to hook in DirectiveRecord query mechanism
|
6
|
+
* Dropped ActiveRecord::Relation#size override
|
7
|
+
|
3
8
|
== Version 0.1.9 (March 4, 2015)
|
4
9
|
|
5
10
|
* Overridden ActiveRecord::Relation#size to hook in DirectiveRecord query mechanism
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
@@ -13,10 +13,14 @@ module ActiveRecord
|
|
13
13
|
klass.qry qry_options(*args)
|
14
14
|
end
|
15
15
|
|
16
|
-
alias :
|
16
|
+
alias :original_count :count
|
17
17
|
|
18
|
-
def
|
19
|
-
loaded?
|
18
|
+
def count(column_name = nil, options = {})
|
19
|
+
if !loaded? && (column_name == :all) && (options == {})
|
20
|
+
qry("COUNT(*)")[0][0]
|
21
|
+
else
|
22
|
+
original_count column_name, options
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
end
|
@@ -35,19 +35,32 @@ module Unit
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe "#
|
39
|
-
describe "when
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
describe "#count" do
|
39
|
+
describe "when only passing :all" do
|
40
|
+
describe "when loaded" do
|
41
|
+
it "invokes the original count method" do
|
42
|
+
@relation.expects(:loaded?).returns(true)
|
43
|
+
@relation.expects(:original_count)
|
44
|
+
@relation.count(:all)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
describe "when not loaded" do
|
48
|
+
it "uses qry to count the records" do
|
49
|
+
@relation.expects(:loaded?).returns(false)
|
50
|
+
@relation.expects(:qry).with("COUNT(*)").returns([[1982]])
|
51
|
+
assert_equal 1982, @relation.count(:all)
|
52
|
+
end
|
44
53
|
end
|
45
54
|
end
|
46
|
-
describe "when
|
47
|
-
it "
|
55
|
+
describe "when otherwise" do
|
56
|
+
it "invokes the original count method" do
|
57
|
+
@relation.expects(:loaded?).returns(false)
|
58
|
+
@relation.expects(:original_count)
|
59
|
+
@relation.count(:foo)
|
60
|
+
|
48
61
|
@relation.expects(:loaded?).returns(false)
|
49
|
-
@relation.expects(:
|
50
|
-
|
62
|
+
@relation.expects(:original_count)
|
63
|
+
@relation.count(:all, {:foo => :bar})
|
51
64
|
end
|
52
65
|
end
|
53
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: directiverecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Engel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|