I would need to see Company#root_categories
to be sure, however I predict that root_categories
in-fact includes new_root
.
Is is due to the lazy evaluation of queries in Rails.
Try changing:
current_roots = company.root_categories
to:
current_roots = company.root_categories.all