Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion lib/positioning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def positioned(on: [], column: :position)
reflection = reflections[scope_component]

if reflection&.belongs_to?
positioning_columns[column][:scope_columns] << reflection.foreign_key
positioning_columns[column][:scope_columns].concat Array(reflection.foreign_key).map(&:to_s)
Comment thread
brendon marked this conversation as resolved.
Outdated
positioning_columns[column][:scope_columns] << reflection.foreign_type if reflection.polymorphic?
positioning_columns[column][:scope_associations] << reflection.name
else
Expand Down
8 changes: 6 additions & 2 deletions lib/positioning/mechanisms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ def positioning_scope_changed?
end

def destroyed_via_positioning_scope?
@positioned.destroyed_by_association && scope_columns.any? do |scope_column|
@positioned.destroyed_by_association.foreign_key == scope_column
return false unless @positioned.destroyed_by_association
Comment thread
brendon marked this conversation as resolved.
Outdated

foreign_keys = Array(@positioned.destroyed_by_association.foreign_key).map(&:to_s)
Comment thread
brendon marked this conversation as resolved.
Outdated

scope_columns.any? do |scope_column|
foreign_keys.include?(scope_column.to_s)
Comment thread
brendon marked this conversation as resolved.
Outdated
end
end
end
Expand Down
26 changes: 26 additions & 0 deletions test/test_positioning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,32 @@ def test_destroyed_via_positioning_scope?
list.destroy
assert mechanisms.send(:destroyed_via_positioning_scope?)
end

def test_destroyed_via_positioning_scope_with_composite_foreign_key
list = List.create name: "List"
item = list.items.create name: "Item"

mechanisms = Positioning::Mechanisms.new(item, :position)

mock_association = mock
Comment thread
brendon marked this conversation as resolved.
Outdated
mock_association.stubs(:foreign_key).returns(["list_id", "other_key"])
item.stubs(:destroyed_by_association).returns(mock_association)

assert mechanisms.send(:destroyed_via_positioning_scope?)
end

def test_destroyed_via_positioning_scope_with_composite_foreign_key_no_match
list = List.create name: "List"
item = list.items.create name: "Item"

mechanisms = Positioning::Mechanisms.new(item, :position)

mock_association = mock
mock_association.stubs(:foreign_key).returns(["other_key", "another_key"])
item.stubs(:destroyed_by_association).returns(mock_association)

refute mechanisms.send(:destroyed_via_positioning_scope?)
end
end

class TestPositioningScopes < Minitest::Test
Expand Down
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/minitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
Comment thread
brendon marked this conversation as resolved.
Outdated
#
# This file was generated by RubyGems.
#
# The application 'minitest' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('minitest', 'minitest', version)
else
gem "minitest", version
load Gem.bin_path("minitest", "minitest", version)
end
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/racc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
#
# This file was generated by RubyGems.
#
# The application 'racc' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('racc', 'racc', version)
else
gem "racc", version
load Gem.bin_path("racc", "racc", version)
end
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('rake', 'rake', version)
else
gem "rake", version
load Gem.bin_path("rake", "rake", version)
end
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
#
# This file was generated by RubyGems.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('rubocop', 'rubocop', version)
else
gem "rubocop", version
load Gem.bin_path("rubocop", "rubocop", version)
end
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/ruby-parse
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
#
# This file was generated by RubyGems.
#
# The application 'parser' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('parser', 'ruby-parse', version)
else
gem "parser", version
load Gem.bin_path("parser", "ruby-parse", version)
end
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/ruby-rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
#
# This file was generated by RubyGems.
#
# The application 'parser' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('parser', 'ruby-rewrite', version)
else
gem "parser", version
load Gem.bin_path("parser", "ruby-rewrite", version)
end
29 changes: 29 additions & 0 deletions vendor/bundle/ruby/3.2.0/bin/standardrb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby3.2
#
# This file was generated by RubyGems.
#
# The application 'standard' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('standard', 'standardrb', version)
else
gem "standard", version
load Gem.bin_path("standard", "standardrb", version)
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/ast-2.4.3.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/base64-0.3.0.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/drb-2.2.3.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/i18n-1.14.8.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/json-2.19.3.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/logger-1.7.0.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/mocha-3.0.2.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/prism-1.9.0.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/racc-1.8.1.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/rainbow-3.1.1.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/rake-13.3.1.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/timeout-0.6.1.gem
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/tzinfo-2.0.6.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/bundle/ruby/3.2.0/cache/uri-1.1.1.gem
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
current directory: /home/runner/work/positioning/positioning/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal
/usr/bin/ruby3.2 -I/usr/lib/ruby/vendor_ruby extconf.rb
checking for __builtin_clz()... yes
checking for __builtin_clzl()... yes
checking for __builtin_clzll()... yes
checking for float.h... yes
checking for math.h... yes
checking for stdbool.h... yes
checking for stdlib.h... yes
checking for x86intrin.h... yes
checking for _lzcnt_u32() in x86intrin.h... no
checking for _lzcnt_u64() in x86intrin.h... no
checking for intrin.h... no
checking for ruby/atomic.h... yes
checking for ruby/internal/has/builtin.h... yes
checking for ruby/internal/static_assert.h... yes
checking for rb_complex_real() in ruby.h... yes
checking for rb_complex_imag() in ruby.h... yes
checking for rb_opts_exception_p() in ruby.h... yes
checking for rb_category_warn() in ruby.h... yes
checking for RB_WARN_CATEGORY_DEPRECATED in ruby.h... yes
creating Makefile

current directory: /home/runner/work/positioning/positioning/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20260326-4917-qac7dy sitelibdir\=./.gem.20260326-4917-qac7dy clean

current directory: /home/runner/work/positioning/positioning/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20260326-4917-qac7dy sitelibdir\=./.gem.20260326-4917-qac7dy
compiling bigdecimal.c
compiling missing.c
linking shared-object bigdecimal.so

current directory: /home/runner/work/positioning/positioning/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20260326-4917-qac7dy sitelibdir\=./.gem.20260326-4917-qac7dy install
/usr/bin/install -c -m 0755 bigdecimal.so ./.gem.20260326-4917-qac7dy

current directory: /home/runner/work/positioning/positioning/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20260326-4917-qac7dy sitelibdir\=./.gem.20260326-4917-qac7dy clean
Loading
Loading