lib/positioning/mechanisms.rb in positioning-0.4.1 vs lib/positioning/mechanisms.rb in positioning-0.4.2
- old
+ new
@@ -190,20 +190,22 @@
def lock_positioning_scope!
if scope_associations.present?
scope_associations.each do |scope_association|
if @positioned.persisted? && positioning_scope_changed?
- record_scope.first.send(scope_association)&.lock!
+ associated_record = record_scope.first.send(scope_association)
+ associated_record.class.base_class.lock.find(associated_record.id) if associated_record
end
- @positioned.send(scope_association)&.lock!
+ associated_record = @positioned.send(scope_association)
+ associated_record.class.base_class.lock.find(associated_record.id) if associated_record
end
else
if @positioned.persisted? && positioning_scope_changed?
- positioning_scope_was.lock!
+ positioning_scope_was.lock.all.load
end
- positioning_scope.lock!
+ positioning_scope.lock.all.load
end
end
def positioning_scope_was
base_class.where record_scope.first.slice(*scope_columns)