mongoid_money_field 4.0.4 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid_money_field/version.rb +1 -1
- data/lib/mongoid_money_field.rb +17 -15
- 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: 447b45a00144769201cfd7519b2b0c1e7f8640bd
|
4
|
+
data.tar.gz: 3c34a7db0ba4090d6935943c084ee85d1aef50d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f5e6392c26675796016c3c6dd7fe38b11f6f20cc3ac06cd71c22bcbdf5ab8ae0e9d27151ce37b541f95679f43533493f2acf2fc832c4a940c2de539116fe943
|
7
|
+
data.tar.gz: c14d2d9014cbb292f6aaa9a5550c3d6b6d97745e66631ea138d2f426a7a706cb84d41cff3f37950dcc2b60019849d552f5b01d00a84a3e8c3f990fdf9d2e27d4
|
data/lib/mongoid_money_field.rb
CHANGED
@@ -97,24 +97,26 @@ module Mongoid
|
|
97
97
|
|
98
98
|
# deprecated
|
99
99
|
define_method("migrate_#{name}_from_money_3!") do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
if
|
108
|
-
|
109
|
-
|
110
|
-
|
100
|
+
if read_attribute(name).nil?
|
101
|
+
cents = read_attribute("#{name}_cents")
|
102
|
+
if cents.nil?
|
103
|
+
send("#{name}=", nil)
|
104
|
+
else
|
105
|
+
currency = read_attribute("#{name}_currency")
|
106
|
+
|
107
|
+
if currency.nil?
|
108
|
+
if opts[:default_currency].nil?
|
109
|
+
currency = Money.default_currency
|
110
|
+
else
|
111
|
+
currency = opts[:default_currency]
|
112
|
+
end
|
111
113
|
end
|
112
|
-
end
|
113
114
|
|
114
|
-
|
115
|
-
|
115
|
+
unless opts[:fixed_currency].nil?
|
116
|
+
currency = opts[:fixed_currency]
|
117
|
+
end
|
118
|
+
send("#{name}=", Money.new(cents, currency))
|
116
119
|
end
|
117
|
-
send("#{name}=", Money.new(cents, currency))
|
118
120
|
end
|
119
121
|
end
|
120
122
|
|
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.5
|
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-
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|