elastic_record 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '0.8.0'
5
+ s.version = '0.8.1'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -15,7 +15,10 @@ module ElasticRecord
15
15
  def as_search
16
16
  json = {}
17
17
  elastic_index.mapping[:properties].each_key do |key|
18
- if respond_to?(key) && (value = send(key)).present?
18
+ next unless respond_to?(key)
19
+ value = value = send(key)
20
+
21
+ if value.present? || value == false
19
22
  json[key] = value
20
23
  end
21
24
  end
@@ -34,5 +34,9 @@ class ElasticRecord::CallbacksTest < MiniTest::Spec
34
34
  Widget.new(id: '10', color: '').tap do |widget|
35
35
  assert_equal({}, widget.as_search)
36
36
  end
37
+
38
+ Widget.new(id: '10', color: false).tap do |widget|
39
+ assert_equal({color: false}, widget.as_search)
40
+ end
37
41
  end
38
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-11 00:00:00.000000000 Z
12
+ date: 2012-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic