positioning 0.2.1 → 0.2.2

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: e9a6be17ba30233c2d789bbc32055280262feee10c5cef80badc42f18b829f13
4
- data.tar.gz: 68e477089f16ad23111bc8e5e39f43f8c2bcac389b04ee5855d0729d1a50771f
3
+ metadata.gz: 9e6d1d78422ff0b404f4a6c0d38d4bd8bce62600e322e7ba4d67cd6caf781fac
4
+ data.tar.gz: 0625ae933d5eab6bc6bf0d9cc1b510b37c0b8ad29657260b90c08f79a51ef2bc
5
5
  SHA512:
6
- metadata.gz: 6cce0ad940005e740b64c858250e425307578aa37697f35258f886acdb9de31954db04bc73589dd0931cc6665b1f5e5ddf0439f195ea0caa6010a66eed1f882d
7
- data.tar.gz: 9f9a8587420495b693b340bd8108328116fb2414b7879ab90be3e8e2b2740346730fff4e5434c3bb951aead42d739c23fcb409d62843eea6bf73318b96e4724e
6
+ metadata.gz: 052bfedb7143dcec3259f9f16beaa0102c34b6a268d1599f103ce70dd04bac9c8dfb507820137d0c035ef0ab730cba7dcf77fe0060b7cc4c0902aea3093e40ef
7
+ data.tar.gz: fba0dc8f0583588f127d4755b3a03f03ed0e39b9c9f5badafc6b3637d27e37084860df2cbe9c553d01f23452a9437302714c415049eb6764c82a30a9b904ff4d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.2] - 2024-05-17
4
+
5
+ - When destroying a positioned item, first move it out of the way (position = 0) then contract the scope. Do this before destruction. Moving the item out of the way memoizes its original position to cope with the case where multiple items are destroyed with `destroy_all` as they'll have their position column cached. Thanks @james-reading for the report.
6
+
3
7
  ## [0.2.1] - 2024-04-08
4
8
 
5
9
  - Fetch the adapter_name from #connection_db_config (@tijn)
@@ -39,7 +39,10 @@ module Positioning
39
39
  end
40
40
 
41
41
  def destroy_position
42
- contract(positioning_scope, (position + 1)..) unless destroyed_via_positioning_scope?
42
+ unless destroyed_via_positioning_scope?
43
+ move_out_of_the_way
44
+ contract(positioning_scope, (position_was + 1)..)
45
+ end
43
46
  end
44
47
 
45
48
  private
@@ -1,3 +1,3 @@
1
1
  module Positioning
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/positioning.rb CHANGED
@@ -51,7 +51,7 @@ module Positioning
51
51
 
52
52
  before_create { Mechanisms.new(self, column).create_position }
53
53
  before_update { Mechanisms.new(self, column).update_position }
54
- after_destroy { Mechanisms.new(self, column).destroy_position }
54
+ before_destroy { Mechanisms.new(self, column).destroy_position }
55
55
 
56
56
  after_commit advisory_lock
57
57
  after_rollback advisory_lock
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: positioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendon Muir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-08 00:00:00.000000000 Z
11
+ date: 2024-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport