Hello, I am not sure how many people are using the shiny new tree version of dragdrop.js - well it seems that someone arbitrarily changed part of my implementation and has broken the functionality with rails: 864 serialize: function(element) { 865 element = $(element); 866 var options = Object.extend(Sortable.options(element), arguments[1] || {}); 867 var name = encodeURIComponent( 868 (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); 869 870 if (options.tree) { 871 return Sortable.tree(element, arguments[1]).children.map( function (item) { 872 return [name + Sortable._constructIndex(item) + "=" + 873 encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 874 }).flatten().join('&'); 875 } else { 876 return Sortable.sequence(element, arguments[1]).map( function(item) { 877 return name + "[]=" + encodeURIComponent(item); 878 }).join('&'); 879 } 880 } 881 } The problem lies on lie 872. Basically, this will form a query string that looks like this: tree[0]=1&tree[0][0]=2 which should obviously be illegal - if tree[0] is a string (ie, tree[0]=1) then it cannot then suddenly be a hash (tree[0][0]=2). This is a regression due to someones short-sightedness who made a change without testing it out or even really thinking about why it was there in the first place. The fix is simply to add a layer of indirection: 872 return [name + Sortable._constructIndex(item) + "[id]=" + Without this, you will get all sorts of weird rails errors, which will probably make no sense. Anyway, I have checked in a revision into the repository, feel free to check it out, and I hope it can get into the scriptaculous as soon as possible! The wiki has some useful code to implement this in your database! Great, have fun. The repository is at: http://oriontransfer.co.nz/svn/SortableTree Sammi |
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs