positioning 0.4.0 → 0.4.1

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: 98446468efcfe543a72a5bf354b5e8c8408951dfc15072968df64500dc9e0275
4
- data.tar.gz: a814a905f38b39064d8871a883b3bb4d68b2c446f0cec33d93f4c37671fcc33c
3
+ metadata.gz: fdc57e74504d876181c7f4b4355f4a3b2831bb8da768164fa4ff6aaf00655164
4
+ data.tar.gz: ed8daeb88c81490abfc233e9c853b19dd38da72e7ec5c05648cc4e221dbab62e
5
5
  SHA512:
6
- metadata.gz: 339a65265898c0b0e7b0e1758e708f57b4ee49d3b8fad1e93489058e6cbc047022e8d0cd42fcbe7793dad1a52dc04784e4122ce9e53d4360988f77f296f45c9f
7
- data.tar.gz: 5443a095efe22bb69a079d51ae3bea37b78bd7035a3f0e07580c45006bbff98d44af7aeb17771622a4d33e98f8d0b3b957929a0b6a84ff54d3696684c3534ff2
6
+ metadata.gz: 5ebe0ebd308d7937b6838d819e64bf8ce3728bf938c2c69b123c264cd351b8f6a20e66406abcda68c091ef4a6fdb270b638eccab0310eb1776ca8bd06ba7bded
7
+ data.tar.gz: edcfe4c7f0ca38e6660f956910c6f7d6a70430ffe6949bb098c28ba37d95aaafc33cacdfd3e002a6384fb43c84e9c625b2cbf8498a541cc850bf9e9a9e85bf69
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2024-10-12
4
+
5
+ - Fix locking where a `belongs_to` association is `optional: true`.
6
+
3
7
  ## [0.4.0] - 2024-10-12
4
8
 
5
9
  - BREAKING CHANGE: Advisory Lock has been removed. If you explicitly define `advisory_lock: false` in your `positioned` call, you'll need to remove this.
@@ -191,11 +191,17 @@ module Positioning
191
191
  def lock_positioning_scope!
192
192
  if scope_associations.present?
193
193
  scope_associations.each do |scope_association|
194
- record_scope.first.send(scope_association).lock! if @positioned.persisted? && positioning_scope_changed?
195
- @positioned.send(scope_association).lock!
194
+ if @positioned.persisted? && positioning_scope_changed?
195
+ record_scope.first.send(scope_association)&.lock!
196
+ end
197
+
198
+ @positioned.send(scope_association)&.lock!
196
199
  end
197
200
  else
198
- positioning_scope_was.lock! if @positioned.persisted? && positioning_scope_changed?
201
+ if @positioned.persisted? && positioning_scope_changed?
202
+ positioning_scope_was.lock!
203
+ end
204
+
199
205
  positioning_scope.lock!
200
206
  end
201
207
  end
@@ -1,3 +1,3 @@
1
1
  module Positioning
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: positioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendon Muir