So awesome_nested_set protects its parent_id attribute and even redefines the parent_id= method. This is causing me difficulty.
My models have a uniqueness constraint on :name that is scoped by parent_id. So I could create records with attrs
{ :name => foo, :parent_id => nil }, and { :name=> foo, :parent_id => 1 }
and they would be valid because they have different parents.
But, as best I can figure, to construct these with a_n_s I am supposed to create 2 records with
{ :name => foo }
and then hit one with move_to_root and the other with move_node_to_child(1). But I cant do that because creating 2 records with the same name and parent_id defaulting to nil fails validation.
I think I need to specify the parent at creation time. Is there any way I can get a_n_s to allow this??
Thanks/