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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ca78baede197271950dd4171393ec32c9f3698f
4
- data.tar.gz: 59a76cb0577d8b8293a1925d5ca071c889d61cbb
3
+ metadata.gz: b622b89e04dbec6f3f700f5c85fc395c010b2930
4
+ data.tar.gz: c31e4c65fe75099e6cdf24ecbd571ce5d2435017
5
5
  SHA512:
6
- metadata.gz: 7b0810673c9631f7e60e0e9b7e4796b579c4c1b8b943f76f7dc0890a631f2b5fd0fbd08ca507d0abfaad198697206167ef6fcd84451123b759ca52d96abd6c2e
7
- data.tar.gz: a5f4d40a976c593e3e6b149cf28573955b5e60381c24d2c4b8a04a92afcba110e3787784db5c127600bac5e9da7335a72c6ba0be7db021d8a8792509139f84b5
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "cassandro"
5
- s.version = "2.0.0"
5
+ s.version = "2.0.1"
6
6
  s.summary = "Ruby ORM for Apache Cassandra"
7
7
  s.license = "MIT"
8
8
  s.description = "Lightweight Apache Cassandra ORM for Ruby"
@@ -38,7 +38,7 @@ person.ttl # => 20
38
38
  person.ttl # => 18
39
39
  ```
40
40
 
41
- ### Enabling Soft Delete
41
+ ## Enabling Soft Delete
42
42
 
43
43
 
44
44
  ```Ruby
@@ -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')
@@ -43,3 +43,5 @@ table = <<-TABLEDEF
43
43
  )
44
44
  TABLEDEF
45
45
  SESSION.execute(table)
46
+ SESSION.execute("CREATE INDEX ON admins (deleted)")
47
+
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.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-07 00:00:00.000000000 Z
12
+ date: 2015-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cassandra-driver