On 1.4 Beta 6, I tried to move a category with a parent to be its own top level category. I get an error message in the dialog (“Sorry an error has occurred”). Chrome’s dev tools say:
Failed to load resource: the server responded with a status of 422 (Unprocessable Entity)
Here’s the validation logic around parent categories:
def parent_category_validator
if parent_category_id
errors.add(:base, I18n.t("category.errors.self_parent")) if parent_category_id == id
errors.add(:base, I18n.t("category.errors.uncategorized_parent")) if uncategorized?
grandfather_id = Category.where(id: parent_category_id).pluck(:parent_category_id).first
errors.add(:base, I18n.t("category.errors.depth")) if grandfather_id
end
end
That shouldn’t trigger when making the parent nil.