effective_addresses 1.9.2 → 1.9.3

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
  SHA256:
3
- metadata.gz: f68f7e9190672bf40b176596387019c6e4ff3ce76f299950469dba367eca0d77
4
- data.tar.gz: 180012dead028e83f163659605bc5f55dc9c345f3fccce1e201cf140f83c21a4
3
+ metadata.gz: e41141e340c412a2e083dfb79792a86f102484fe61734eebf85963ba17c287c8
4
+ data.tar.gz: f0f60629f50f7f20e3e8ba6976e6ba9554b18ed6bb38870a4653ab1ad33b9c17
5
5
  SHA512:
6
- metadata.gz: b879876863da03b54413dd98e9bce145e77e166b99822d8315c1f2d9620c150fb9999a1303aaeeb75e256c28aae9bc64c47391a1713deca10d53b6d462d78196
7
- data.tar.gz: d6855b8a7b2b6171c1a88d973abd73347152ab5ce90884ded6409136f767aaf07b087126045bbc4a743f1605e2a9fe9cf1597d567f60d6e5227d4aa18de7c63e
6
+ metadata.gz: 934bf8000a28eb370e5f444d6f70610ea7b63f5c0d71c0e1da9f1ed0d83265b697b424489b732d2469e3a23edde57c603d11b2daf2aec9a4688635239e45ee4d
7
+ data.tar.gz: 170e98c482c1d99e3907864773762f487f0b61b0e5fc8399ffcac6c11f4d03655b547450d0c7a8ae856b97a7b13469bbe83f7a602ad8304b9ae32397f9f82179
@@ -37,7 +37,7 @@ module EffectiveAddressesHelper
37
37
  end
38
38
  end
39
39
 
40
- def effective_address_regions_collection(regions = nil)
40
+ def effective_address_regions_collection(regions = nil, resource: nil)
41
41
  if regions.present?
42
42
  countries = regions
43
43
  elsif EffectiveAddresses.country_codes == :all
@@ -61,7 +61,15 @@ module EffectiveAddressesHelper
61
61
  )
62
62
  end
63
63
 
64
+ # Special behaviour if the address has CAN, we treat it as CA
65
+ if regions.blank? && resource.present? && resource.country_code == 'CAN'
66
+ ca = countries.index { |_, code| code == 'CA' }
67
+
68
+ if ca.present?
69
+ countries[ca] = ['Canada', 'CAN']
70
+ end
71
+ end
72
+
64
73
  countries
65
74
  end
66
75
  end
67
-
@@ -41,7 +41,7 @@
41
41
 
42
42
  .row
43
43
  .col-md-4
44
- = fa.select :country_code, effective_address_regions_collection(),
44
+ = fa.select :country_code, effective_address_regions_collection(resource: fa.object),
45
45
  label: 'Country',
46
46
  required: required,
47
47
  disabled: same_as_billing,
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.9.2'.freeze
2
+ VERSION = '1.9.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails