cassandro 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/cassandro.gemspec +1 -1
- data/docs/advanced_features.md +1 -1
- data/lib/cassandro/model.rb +1 -1
- data/test/cassandro_model_test.rb +6 -0
- data/test/support/tables.rb +2 -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: b622b89e04dbec6f3f700f5c85fc395c010b2930
|
4
|
+
data.tar.gz: c31e4c65fe75099e6cdf24ecbd571ce5d2435017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee2cbec11f800c0557ebf54f095b7e9c0e03fc6593401e7023c55aa58d47682ed12e0a07a7e9216db940c334706013d3fe28da35bae8f137404cf4f33364b0b
|
7
|
+
data.tar.gz: ee5966c8d96983de83c814ce06d2dd34b295a201afa814da887ee0f5584f10f47a67c64bf90796f6d0918ebb2ed4971e93c657fa0b34ee31bf4f750b88f96b09
|
data/README.md
CHANGED
@@ -8,6 +8,9 @@ Cassandro is a small Ruby ORM for Apache Cassandra 2.0 and CQL 3.0. Cassandro us
|
|
8
8
|
|
9
9
|
## Changelog
|
10
10
|
|
11
|
+
### v2.0.1
|
12
|
+
* Fix `Model#count` for boolean fields
|
13
|
+
|
11
14
|
### v2.0
|
12
15
|
* Support `cassandra-driver` >= 2.0
|
13
16
|
* Allow registering indexes in model's definition
|
data/cassandro.gemspec
CHANGED
data/docs/advanced_features.md
CHANGED
data/lib/cassandro/model.rb
CHANGED
@@ -242,7 +242,7 @@ module Cassandro
|
|
242
242
|
def self.count(key = nil, value = nil)
|
243
243
|
query = "SELECT count(*) FROM #{table_name}"
|
244
244
|
|
245
|
-
if key && value
|
245
|
+
if key && !value.nil?
|
246
246
|
key = key.to_sym
|
247
247
|
query << " WHERE #{key} = ? ALLOW FILTERING"
|
248
248
|
st = Cassandro.client.prepare(query)
|
@@ -176,6 +176,12 @@ Protest.describe "Cassandro Model" do
|
|
176
176
|
assert_equal 1, Test.count(:test_col_1, Cassandra::Uuid.new(uuid))
|
177
177
|
end
|
178
178
|
|
179
|
+
test "counts the rows with boolean filter" do
|
180
|
+
Admin.create(nickname: "Count Admin 1", deleted: true)
|
181
|
+
Admin.create(nickname: "Count Admin 2", deleted: false)
|
182
|
+
assert_equal 1, Admin.count(:deleted, false)
|
183
|
+
end
|
184
|
+
|
179
185
|
test "ignore columns not defined in model" do
|
180
186
|
uuid = SecureRandom.uuid
|
181
187
|
Test.create(test_col_1: uuid, test_col_2: 'test_value_2')
|
data/test/support/tables.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassandro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lautaro Orazi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cassandra-driver
|