Ah, excellent, thank you! I kind of like the syntax of always calling methods on the XML builder object, but this works well. I figured that if Rails supported this it probably be passing in the builder somehow.
I looked at the Rails 3 documentation (beta3 from apidock: http://apidock.com/rails/v3.0.0.beta3/ActiveRecord/Serialization/to_xml ) and this option didn't seem to be listed. Should I submit a doc patch? Thanks again, Brian ;p On Jun 14, 11:36 pm, Michael Koziarski <[email protected]> wrote: > > So the behavior I want would look something like this (as an sample > > post.xml.builder view): > > > xml.instruct! > > xml.active_record_model_tag!(@post, :attributes => > > [:id, :body, :updated_at]) do > > xml.active_record_model_tag!(@post.author) > > �[email protected] do |comment| > > xml.active_record_model_tag!(comment, :attributes => > > [:id, :body, :created_at], :methods => [:up_vote_percentage]) > > end > > end > > You can actually get something pretty close to this already, it's just > 'backwards' from how you're thinking about it: > > xml.instruct! > @post.to_xml(:builder=>xml, :skip_instruct=>true) > @post.comments.each do |comment| > comment.to_xml(:builder=>xml, :skip_instruct=>true) > end > > -- > Cheers > > Koz -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en.
