mongoid_money_field 4.0.5 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/lib/mongoid_money_field.rb +7 -8
- data/lib/mongoid_money_field/version.rb +1 -1
- data/spec/support/money3.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb761ef70afdee8017350111c75542a7a4e9765c
|
4
|
+
data.tar.gz: 8c0b7e56938556f2719985fa9824074d05c2d725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c72d777540e4a3844e451aa26c91664afcaa841b7424bf70404313748e2a4141661a10cb5cddac9a1a1a3f8d66eb08fa597507d45f5479b5722ef2bdfde84a8
|
7
|
+
data.tar.gz: c29933f33e22c2391553b1a266ad16b5096fd1c4e165c76c126d37d4c257c155aa0cf728bb99886552b5e6d8505c2485c75934f80daace556b0f8370d0bfce5a
|
data/.travis.yml
CHANGED
data/lib/mongoid_money_field.rb
CHANGED
@@ -66,14 +66,18 @@ module Mongoid
|
|
66
66
|
end
|
67
67
|
|
68
68
|
write_attribute(name, money)
|
69
|
-
remove_attribute("#{name}_currency")
|
70
|
-
remove_attribute("#{name}_cents")
|
71
69
|
end
|
70
|
+
remove_attribute("#{name}_currency")
|
71
|
+
remove_attribute("#{name}_cents")
|
72
72
|
end
|
73
73
|
|
74
74
|
# mongoid money field 2 compat
|
75
75
|
define_method(name) do
|
76
|
-
if read_attribute("#{name}_cents").nil?
|
76
|
+
if read_attribute("#{name}").nil? && !read_attribute("#{name}_cents").nil?
|
77
|
+
currency = read_attribute("#{name}_currency")
|
78
|
+
currency = ensure_default.call(currency)
|
79
|
+
Money.new(read_attribute("#{name}_cents"), currency)
|
80
|
+
else
|
77
81
|
value = read_attribute(name)
|
78
82
|
if value.nil?
|
79
83
|
nil
|
@@ -83,11 +87,6 @@ module Mongoid
|
|
83
87
|
end
|
84
88
|
Money.demongoize(value)
|
85
89
|
end
|
86
|
-
|
87
|
-
else
|
88
|
-
currency = read_attribute("#{name}_currency")
|
89
|
-
currency = ensure_default.call(currency)
|
90
|
-
Money.new(read_attribute("#{name}_cents"), currency)
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
data/spec/support/money3.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_money_field
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Tv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|