mongoid_money_field 4.0.5 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 447b45a00144769201cfd7519b2b0c1e7f8640bd
4
- data.tar.gz: 3c34a7db0ba4090d6935943c084ee85d1aef50d6
3
+ metadata.gz: cb761ef70afdee8017350111c75542a7a4e9765c
4
+ data.tar.gz: 8c0b7e56938556f2719985fa9824074d05c2d725
5
5
  SHA512:
6
- metadata.gz: 1f5e6392c26675796016c3c6dd7fe38b11f6f20cc3ac06cd71c22bcbdf5ab8ae0e9d27151ce37b541f95679f43533493f2acf2fc832c4a940c2de539116fe943
7
- data.tar.gz: c14d2d9014cbb292f6aaa9a5550c3d6b6d97745e66631ea138d2f426a7a706cb84d41cff3f37950dcc2b60019849d552f5b01d00a84a3e8c3f990fdf9d2e27d4
6
+ metadata.gz: 5c72d777540e4a3844e451aa26c91664afcaa841b7424bf70404313748e2a4141661a10cb5cddac9a1a1a3f8d66eb08fa597507d45f5479b5722ef2bdfde84a8
7
+ data.tar.gz: c29933f33e22c2391553b1a266ad16b5096fd1c4e165c76c126d37d4c257c155aa0cf728bb99886552b5e6d8505c2485c75934f80daace556b0f8370d0bfce5a
@@ -3,5 +3,6 @@ services: mongodb
3
3
 
4
4
  rvm:
5
5
  - 1.9.3
6
- - rbx-19mode
7
- - jruby-19mode
6
+ - 2.0.0
7
+ - 2.1.1
8
+
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module MongoidMoneyField
2
- VERSION = "4.0.5"
2
+ VERSION = "4.0.6"
3
3
  end
@@ -24,7 +24,7 @@ class Money3Compat
24
24
 
25
25
  field :description
26
26
 
27
- money_field :price, default: 0
27
+ money_field :price
28
28
  money_field :price_no_default
29
29
  money_field :price_with_fix, fixed_currency: 'GBP'
30
30
  end
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.5
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-03 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid