mongoid_money_field 7.3.0 → 7.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mongoid_money_field/field.rb +2 -4
- data/lib/mongoid_money_field/type.rb +1 -3
- data/lib/mongoid_money_field/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5d42e0e5b76a46f273daf85b160ff381397b65464f10dcc5755ffc32dcda6cd
|
4
|
+
data.tar.gz: 58093c0fd31e48717a0bc26e075d94f35bb27fb6b1d94d1dffc6263234244322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c813bb22e338eb7d9ab013ee1580cebd783be96840f55c0214b3a34b19f37420b6cd8a6dd710005c7c4389cb0b22efb28cf4596644c3d6678c0e56203c934df9
|
7
|
+
data.tar.gz: 871c56d08a3863894300171d5b56702a0e6d226a8e49fa984797fb129e4c8dc01b88b4817e1bba8b959f01d77c0c974617c54ad918be85a660663d1060c30ded
|
data/Gemfile.lock
CHANGED
@@ -16,7 +16,7 @@ class Money
|
|
16
16
|
# this custom class from it.
|
17
17
|
def demongoize(object)
|
18
18
|
if object.is_a?(Hash)
|
19
|
-
object = object.symbolize_keys
|
19
|
+
object = object.symbolize_keys unless object.is_a?(BSON::Document)
|
20
20
|
object.has_key?(:cents) ? ::Money.new(object[:cents], object[:currency_iso]) : nil
|
21
21
|
else
|
22
22
|
nil
|
@@ -27,11 +27,9 @@ class Money
|
|
27
27
|
# stored in the database.
|
28
28
|
def mongoize(object)
|
29
29
|
case
|
30
|
-
when object.is_a?(BSON::Document) then
|
31
|
-
::Money.new(object[:cents], object[:currency_iso]).mongoize
|
32
30
|
when object.is_a?(Money) then object.mongoize
|
33
31
|
when object.is_a?(Hash) then
|
34
|
-
object.symbolize_keys! if object.respond_to?(:symbolize_keys!)
|
32
|
+
object.symbolize_keys! if object.respond_to?(:symbolize_keys!) && !object.is_a?(BSON::Document)
|
35
33
|
::Money.new(object[:cents], object[:currency_iso]).mongoize
|
36
34
|
when object.respond_to?(:to_money) then
|
37
35
|
object.to_money.mongoize
|
@@ -48,11 +48,9 @@ class MoneyType
|
|
48
48
|
end
|
49
49
|
|
50
50
|
ret = case
|
51
|
-
when object.is_a?(BSON::Document) then
|
52
|
-
::Money.new(object[:cents], object[:currency_iso]).mongoize
|
53
51
|
when object.is_a?(Money) then object.mongoize
|
54
52
|
when object.is_a?(Hash) then
|
55
|
-
object.symbolize_keys! if object.respond_to?(:symbolize_keys!)
|
53
|
+
object.symbolize_keys! if object.respond_to?(:symbolize_keys!) && !object.is_a?(BSON::Document)
|
56
54
|
::Money.new(object[:cents], object[:currency_iso]).mongoize
|
57
55
|
when object.blank? then
|
58
56
|
if !@options[:default].nil?
|