Method to find posts in children categories
Some notes:


You should limit the lines to 80/100 chars.
When a call chain seems to include too much logic, move it to methods/class-methods of models.


As a first refactor, I'd implement Category#with_children and then write:

@categories_posts = current_user.
  get_voted(Category).
  flat_map(&amp;:with_children).
  flat_map(&amp;:posts).
  reject { |post| post.status == "draft" }


On a second refactor, it's nice to have relations instead of arrays as output. This way you can use scopes, paginators and such, even if you cannot directly use has_many here (because of the recursive category requirement):

categories = current_user.get_voted(Category).flat_map(&amp;:with_children)
@categories_posts = Post.where(category: categories).published


That's to show the implementation, on the controller you should still have less logic, something like this: @categories_posts = current_user.posts_of_voted_categories.published.