Skip to content

Commit

Permalink
Merge pull request #4992 from julienanne/improve-update-positions-com…
Browse files Browse the repository at this point in the history
…patibility-with-uuid

Authorize uuid for update_positions on ResourceController
  • Loading branch information
kennyadsl authored Apr 14, 2023
2 parents fd277b0 + 5832d47 commit 554d335
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/app/controllers/spree/admin/resource_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def update_positions
records = model_class.where(id: positions.keys).to_a

positions.each do |id, index|
records.find { |r| r.id == id.to_i }&.set_list_position(index)
# To permit the use of UUID as id, we compare models id in database
# and in params under the string representation instead of integer
records.find { |r| r.id.to_s == id }&.set_list_position(index)
end
end

Expand Down

0 comments on commit 554d335

Please sign in to comment.