I have a Category that can have Headers which are acts_as_tree. The structue could this be like:
class Category < ActiveRecord::Base
has_many :headers
end
class Header < ActiveRecord::Base
belongs_to :category
acts_as_tree :order => :position
end
Category:
Header
Header
Header
Header
Header
Header
I'd like to extract all of the ids of the Headers for a Category.
Is there something that's done for me automatically? Or is there a simple way to traverse?
thx in advance
First of all retrieve a category you need like:
then
This line will return the array of headers' ids for a special category