web-connect 0.3.2 → 0.3.3

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: 2d6d07bce951df691ca0c55dd4aefbcf9820268b
4
- data.tar.gz: f9b7d39e82d2c54287615ffbe3cec4cb2bbbcfdb
3
+ metadata.gz: 5d4dd9d54db821723fcfae4cd5da92c4cb7f0eae
4
+ data.tar.gz: eb61afb0a614d86784037143f03b32fe24a91f12
5
5
  SHA512:
6
- metadata.gz: 542d2b415f376a97444957d3703ca2a75a547de472532822f71e1b9a146487eda1a64de6364578e86dfb79111532d2346b30d8596933cdf533bc320e48c43ba1
7
- data.tar.gz: 53396060972b9f7c7ddd5ea8270c7335e924802cff72c80d908870d468b54ca0fe9279d6a9cf08aee35fd5d96c497758d36dbe4a49464e75a9fe762d104d9ad0
6
+ metadata.gz: e73df512556bf4cfab146473e2fd1029b8c947786b08fd458ee0a1356aeb5fb825635dbe7d9baed871022bb04617cbef0c9f96c731661d56b67b2cfa0875773d
7
+ data.tar.gz: eac0ccbf6651b1f03d35a190c02e39f69207f57377aeae70e101c92a8057d8512d4afd6db0396594b56d6fda3bd1e61c91e145e4ad6e5834cb1516dfd8d0e130
@@ -49,7 +49,11 @@ module Netfira::WebConnect
49
49
  klass.include Model::Record::Sendable if klass.sendable?
50
50
 
51
51
  # Set up paranoia (soft deletion)
52
- klass.acts_as_paranoid if Netfira::WebConnect.paranoia?
52
+ if Netfira::WebConnect.paranoia?
53
+ klass.acts_as_paranoid
54
+ else
55
+ def klass.with_deleted; self end
56
+ end
53
57
 
54
58
  # Set up file record behaviour
55
59
  if klass.has_file?
@@ -51,11 +51,12 @@ module Netfira::WebConnect
51
51
 
52
52
  def find_by_origin_id(shop, id)
53
53
  id = id.b if OctaWord === id
54
- find_by origin_key => id, shop_id: shop.id
54
+ with_deleted.find_by origin_key => id, shop_id: shop.id
55
55
  end
56
56
 
57
57
  def find_or_initialize_by_origin_id(shop, id)
58
- find_by_origin_id(shop, id) || new(origin_key => id, shop_id: shop.id)
58
+ find_by_origin_id(shop, id).tap { |record| record.restore! if record && record.destroyed? } or
59
+ new(origin_key => id, shop_id: shop.id)
59
60
  end
60
61
 
61
62
  def find_or_create_by_origin_id(shop, id)
@@ -1,6 +1,6 @@
1
1
  module Netfira
2
2
  module WebConnect
3
- VERSION = '0.3.2'
3
+ VERSION = '0.3.3'
4
4
  PLATFORM_AND_VERSION = 'Rack/' << VERSION
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson