Closed kiddrew closed 9 years ago
The plugin assumes that sortable_attribute (#position
by default) is a field used internally to sort the items. It is best to use a hidden attribute to store the item's sorted positions.
@kiddrew any updates on this?
When I couldn't get it to work initially, I removed the gem and I haven't revisited. I'll close this for now.
First, let me say thanks for the gem. It's very handy.
I just dragged one node so that its parent is now another node in the tree. I notice two things:
UPDATE "ingredients" SET "ancestry" = $1, "name" = $2, "updated_at" = $3 WHERE "ingredients"."id" = 25 [["ancestry", "24"], ["name", 1], ["updated_at", "2014-07-15 21:11:22.834266"]]
The "name" field (my sort attribute) was the name of an ingredient before the move, so something like "nutmeg". The move caused every record in my table to be updated with names that are sequential integers. So the first record is now named "0", the second "1", the third "2", etc. This happened to all 20 records I had in the table.
Anyone have any idea what I'm doing wrong?