mongoid-cached-json 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -126,11 +126,12 @@ module Mongoid
126
126
  clazz = reference_def[:metadata].class_name.constantize
127
127
  end
128
128
  if reference_def[:metadata].relation == Mongoid::Relations::Referenced::ManyToMany
129
- reference_json = object.send(key).map do |id|
129
+ object_ids = object.send(key)
130
+ reference_json = object_ids ? object_ids.map do |id|
130
131
  materialize_keys, json = materialize_json(options, { :clazz => clazz, :id => id })
131
132
  keys = keys ? keys.merge_set(materialize_keys) : materialize_keys
132
133
  json
133
- end.compact
134
+ end.compact : []
134
135
  end
135
136
  end
136
137
  # If we get to this point and reference_json is still nil, there's no chance we can
@@ -1,6 +1,6 @@
1
1
  module Mongoid
2
2
  module CachedJson
3
- VERSION = '1.4.1'
3
+ VERSION = '1.4.2'
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-cached-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-22 00:00:00.000000000 Z
14
+ date: 2013-01-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  segments:
176
176
  - 0
177
- hash: -2872401595226156286
177
+ hash: -3841515240372741329
178
178
  required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  none: false
180
180
  requirements: