Nested routing in Ruby on Rails
Posted
by vooD
on Stack Overflow
See other posts from Stack Overflow
or by vooD
Published on 2010-04-01T08:30:32Z
Indexed on
2010/04/01
8:33 UTC
Read the original article
Hit count: 267
My model class is:
class Category < ActiveRecord::Base
acts_as_nested_set
has_many :children, :foreign_key => "parent_id", :class_name => 'Category'
belongs_to :parent, :foreign_key => "parent_id", :class_name => 'Category'
end
def to_param
slug
end
Is it possible to have such recursive route like this:
/root_category_slug/child_category_slug/child_of_a_child_category_slug
... and so one
Thank you for any help :)
© Stack Overflow or respective owner