shrine 1.4.1 → 1.4.2
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.
Potentially problematic release.
This version of shrine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/shrine/plugins/activerecord.rb +2 -6
- data/lib/shrine/plugins/sequel.rb +9 -7
- data/lib/shrine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c096588cbb135f27c0646661a10884af2d130aa
|
4
|
+
data.tar.gz: cb699c483ecd3e9309dbdcbddfd1c7fb919664b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62d92df4fb94a72f6f6f4e31331ac50b116f0536da7594240d517bb9fa7553cc73e3ff53221b4dc68dbe95fb67e957f6ca34d7f62abb0034889fbfb09498e011
|
7
|
+
data.tar.gz: f01073235dce4eaa882c5b419e162bcfe1ef327754978ae55a6f47b0c7687c4331d9143485dd32696729f83e8087c56e60c9c3c584128416f322efa158c7393b
|
@@ -23,12 +23,10 @@ class Shrine
|
|
23
23
|
#
|
24
24
|
# Also note that if your tests are wrapped in transactions, the
|
25
25
|
# `after_commit` callbacks won't get called, so in order to test uploading
|
26
|
-
# you should first disable
|
26
|
+
# you should first disable transactions for those tests.
|
27
27
|
#
|
28
28
|
# If you want to put some parts of this lifecycle into a background job,
|
29
|
-
# see the backgrounding plugin.
|
30
|
-
# ActiveRecord's [optimistic locking] to eliminate the chance of race
|
31
|
-
# conditions.
|
29
|
+
# see the backgrounding plugin.
|
32
30
|
#
|
33
31
|
# Additionally, any Shrine validation errors will be added to
|
34
32
|
# ActiveRecord's errors upon validation. If you want to validate presence
|
@@ -85,8 +83,6 @@ class Shrine
|
|
85
83
|
record.save(validate: false)
|
86
84
|
end
|
87
85
|
rescue ::ActiveRecord::RecordNotFound
|
88
|
-
rescue ::ActiveRecord::StaleObjectError
|
89
|
-
retry
|
90
86
|
end
|
91
87
|
end
|
92
88
|
end
|
@@ -16,10 +16,9 @@ class Shrine
|
|
16
16
|
# * `after_commit` -- Promotes the attachment, deletes replaced ones.
|
17
17
|
# * `after_destroy_commit` -- Deletes the attachment.
|
18
18
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# called.
|
19
|
+
# Also note that if your tests are wrapped in transactions, the
|
20
|
+
# `after_commit` callbacks won't get called, so in order to test uploading
|
21
|
+
# you should first disable transactions for those tests.
|
23
22
|
#
|
24
23
|
# If you want to put some parts of this lifecycle into a background job,
|
25
24
|
# see the backgrounding plugin.
|
@@ -76,10 +75,13 @@ class Shrine
|
|
76
75
|
# Updates the current attachment with the new one, unless the current
|
77
76
|
# attachment has changed.
|
78
77
|
def update(uploaded_file)
|
79
|
-
record.
|
80
|
-
|
81
|
-
|
78
|
+
if record.send("#{name}_data") == record.reload.send("#{name}_data")
|
79
|
+
record.send("#{name}_data=", uploaded_file.to_json)
|
80
|
+
record.save(validate: false)
|
81
|
+
end
|
82
82
|
rescue ::Sequel::NoExistingObject
|
83
|
+
rescue ::Sequel::Error => error
|
84
|
+
raise unless error.message == "Record not found" # prior to version 4.28
|
83
85
|
end
|
84
86
|
|
85
87
|
# Support for Postgres JSON columns.
|
data/lib/shrine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|