web-connect 0.3.2 → 0.3.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d4dd9d54db821723fcfae4cd5da92c4cb7f0eae
|
4
|
+
data.tar.gz: eb61afb0a614d86784037143f03b32fe24a91f12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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)
|
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)
|