Skip to content

Commit

Permalink
Only create with id if it's composite primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
divagueame committed May 31, 2024
1 parent 4645acf commit 8ecc8b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/shared_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def setup(mixin = ListMixin, mixinError = ListMixinError, id = :id)
@id = id
@mixinError = mixinError
(1..4).each do |counter|
node = @mixin.new parent_id: 5, @id => counter
node = @mixin.new parent_id: 5
node.first_id = counter if @id == :first_id
node.second_id = counter if @id == :first_id
node.pos = counter
node.save!
Expand Down Expand Up @@ -337,7 +338,8 @@ def test_find_or_create_doesnt_raise_deprecation_warning
private

def create_record(opts)
attrs = { @id => opts[:id], parent_id: opts[:parent_id] }
attrs = { parent_id: opts[:parent_id] }
attrs[:first_id] = opts[:id] if @id == :first_id
attrs[:second_id] = opts[:id] if @id == :first_id
@mixin.create(attrs)
end
Expand Down

0 comments on commit 8ecc8b0

Please sign in to comment.