mongoid 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mongoid/extensions/hash/accessors.rb +2 -5
- data/mongoid.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.8
|
@@ -3,13 +3,10 @@ module Mongoid #:nodoc:
|
|
3
3
|
module Hash #:nodoc:
|
4
4
|
module Accessors #:nodoc:
|
5
5
|
def insert(key, attrs)
|
6
|
-
# TODO: Refactor me.
|
7
6
|
store(key, attrs) if key.singular?
|
8
7
|
if key.plural?
|
9
|
-
if
|
10
|
-
elements
|
11
|
-
elements.delete_if { |e| (e[:_id] == attrs[:_id]) }
|
12
|
-
elements << attrs
|
8
|
+
if elements = fetch(key, nil)
|
9
|
+
elements.delete_if { |e| (e[:_id] == attrs[:_id]) } << attrs
|
13
10
|
else
|
14
11
|
store(key, [attrs])
|
15
12
|
end
|
data/mongoid.gemspec
CHANGED