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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 478cb23feb9e6ecc86ca4f9d91cc09aee5325b99
4
- data.tar.gz: 3b1f1728f032f34aeb8dc312d62979c8e335491f
3
+ metadata.gz: 447b45a00144769201cfd7519b2b0c1e7f8640bd
4
+ data.tar.gz: 3c34a7db0ba4090d6935943c084ee85d1aef50d6
5
5
  SHA512:
6
- metadata.gz: f0aa2e2b1f542d7b9f8b0e93bd932faad35f40a3542d1f6bd01b5eec2ed83953c8c32b8269282b57b71ad9bfc4d14fc6ed511968d3443899d439e105e2027025
7
- data.tar.gz: 64702f48ee82d3a78ece7868b2ff26748d942bd2a5bf13160fda39e5a99dff721dc761c2bb91e27653625e4a9c6f7470e0a30273a50651825fe71cfb54232dd8
6
+ metadata.gz: 1f5e6392c26675796016c3c6dd7fe38b11f6f20cc3ac06cd71c22bcbdf5ab8ae0e9d27151ce37b541f95679f43533493f2acf2fc832c4a940c2de539116fe943
7
+ data.tar.gz: c14d2d9014cbb292f6aaa9a5550c3d6b6d97745e66631ea138d2f426a7a706cb84d41cff3f37950dcc2b60019849d552f5b01d00a84a3e8c3f990fdf9d2e27d4
@@ -1,3 +1,3 @@
1
1
  module MongoidMoneyField
2
- VERSION = "4.0.4"
2
+ VERSION = "4.0.5"
3
3
  end
@@ -97,24 +97,26 @@ module Mongoid
97
97
 
98
98
  # deprecated
99
99
  define_method("migrate_#{name}_from_money_3!") do
100
- cents = read_attribute("#{name}_cents")
101
- if cents.nil?
102
- send("#{name}=", nil)
103
- else
104
- currency = read_attribute("#{name}_currency")
105
-
106
- if currency.nil?
107
- if opts[:default_currency].nil?
108
- currency = Money.default_currency
109
- else
110
- currency = opts[:default_currency]
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
- unless opts[:fixed_currency].nil?
115
- currency = opts[:fixed_currency]
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
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-02-17 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid