Righto, not sure if that's the best way to deal with that situation, but will take a look at it with you irl.

In the meantime, a small tip for how to shorten such a bit of code would be to use ``category.try(:parent_id)``.