With the current configuration it is not possible to offer a form with a new parent and its new children, which is a very annoying issue. This due to following:
# New records cannot have children
raise Ancestry::AncestryException.new('No child ancestry for new record. Save record before performing tree operations.') if new_record?
I am not the only one having this problem: http://stackoverflow.com/questions/6286676/rails-ancestry-nested-form
Thanks for this otherwise great gem.
We also have the same problem which make saving nested new forms impossible, it would be super nice if this can be addressed in the near future.
That can be worked around by making a custom save method that validates all children first and then saves them from the root down. This is pretty simple to do.
A bigger problem is that there is nothing that simulates the ability of accepts_nested_attributes_for - there are neither a children= or children_attributes-method. This end up being pretty icky pretty fast, especially in the case of STI.
I've migrated to ancestry... to run in this issue :(
Reverted back to acts_as_tree.
The children reference the parent id
But it would seem something as common as belongs_to would implement something similar.
anyone have ideas how acts_as_tree or other plugins implement this?