Closed mices closed 1 year ago
@mices you created a bunch of issues here.
I can't figure out if you found your answer. Could you close this if you have already found the answer to your question?
Also, all of these issues you have created are based around arrange_as_array
.
Could you keep all of this topic in a single issue rather than creating 5 of them?
Thank you
is this related to #605 ?
I copied and pasted arrange_as_array plus the code that follows up to and including possible_parents from your wiki page Creating a selectbox for a form using ancestry into my model and prepended self. to the definition For some unknown reason it causes an error on create which causes edit action and then it complains that it can't find a record without an id whereas previously the form had displayed with references to object in question just fine It just says block in arrange_as_array and doesn't give any further info
please check out https://github.com/stefankroes/ancestry/blob/master/test/concerns/sort_by_ancestry_test.rb#L36-L43
If you do note, the code in https://github.com/stefankroes/ancestry/blob/master/lib/ancestry/class_methods.rb#L107 is very similar to the one in that wiki article
Let me know if that meets your needs. That test shows how to builds a tree and generates it.
Could you share your script that you are testing this with? Maybe we could update the wiki to meet people's needs better.
ooh. arrange
is part of the standard code.
arrange_as_array(Node.subtree.arrange)
any relation like children
, descendants
, and others works there.
what should the definition for arrange be to go along with arrange_as_array please?