ok,

this is a function, sitting on my model: category.rb


######################################################################
A )
##########
  def full_xml(builder=nil)
    to_xml(:builder => builder, :skip_instruct => true) do |xml|
      children.each { |child| child.full_xml(xml) }
    end
  end
##########

so when i call:

 @category = Category.find params[:id]

 respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @category.full_xml}
 end

> i get a nice recursiv xml data.

######################################################################
B) in this case
 @categorIES = Category.roots #means all with parent_id IS NULL
 but i dont know how to itereate thorugh to build that xml again...


any ideas?

thx




-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to