shrine 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of shrine might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a38bb3cd054c90665a75f94355bdb28ae598591
4
- data.tar.gz: eda94865fdc8f5fbcdff3464015a77e5d8bcfd45
3
+ metadata.gz: 0c096588cbb135f27c0646661a10884af2d130aa
4
+ data.tar.gz: cb699c483ecd3e9309dbdcbddfd1c7fb919664b8
5
5
  SHA512:
6
- metadata.gz: 9160317e038ce1e401b716e49a812ef513ad3ff1cd9cc1a6663b71c3523f948db79c126e187615067e8af8f2436f495c5de3308a41cd27091ba3057dbc8c9e8a
7
- data.tar.gz: da114a5953c31b3868f1bbb31e385b572919cb8ca854ecb1601b5c85a90336b7629628230a5b1c287c6f1b303ac17105b18ff6ad7660bf10fa33fd471f2c3d67
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 these transactions for those tests.
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. In that case you might want to use
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
- # Note that if your tests are wrapped in transactions, for testing
20
- # attachments you should set `Sequel::Model.use_transactions` to `false`,
21
- # so that `after_commit` and `after_destroy_commit` callbacks get properly
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.instance_filter(:"#{name}_data" => record.send("#{name}_data"))
80
- record.send("#{name}_data=", uploaded_file.to_json)
81
- record.save(validate: false)
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.
@@ -6,7 +6,7 @@ class Shrine
6
6
  module VERSION
7
7
  MAJOR = 1
8
8
  MINOR = 4
9
- TINY = 1
9
+ TINY = 2
10
10
  PRE = nil
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
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.1
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-18 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down