I know that you accepted the answer, but I did it before , and therefore it would be useful to explain how we did it:
-, . acts_as_treeacts_as_tree , ancestry, , - ancestry (parent, child ..).
ancestry - , acts_as_tree:
class Category < ActiveRecord::Base
   has_ancestry 
end
ancestry ( parent_id) categories ( ) child, :
@category.parent
@category.children
... ..
-
, child ( ).
. ancestry/acts_as_tree - .
parent "" :

ancetry. , acts_as_tree, ( ), :
class CategoriesController < ApplicationController
   def index
      @categories = Category.all
   end
end
<%= render @categories %>
<%= category.name %>
<%= render category.children if category.has_children? %>
:

:
@subcategories = Category.where parent_id: @category.id
, :
resources :categories
class CategoriesController < ApplicationController
   def show
      @category = Category.find params[:id]
   end
end
:
<% @category.children.each do |subcategory| %>
   <%= subcategory.name %>
<% end %>
