I am overiding the to_xml method inside a model that I have, and it looks like this:
class Model < ActiveRecord::Base #database definitions, and table relationships def to_xml xml = Builder::XmlMarkup.new(:indent => 2) xml.instruct! xml.details do xml.tag!(:name, self.name)# where self calls the data in the column of a database (this works fine), and :name is the name of the column xml.tag!(:street, self.street.to_xml) # this is where is gets caught up * (references a table that is foreign to the table of Model, which is another model (obviously)) end end end
*: this is how I was trying to do it, and for the most part it works, except it just takes the xml doc generated and makes it into a string and puts it into the node details, so when I want to parse it, it won't work.
So I guess my question is there a way to insert nodes from another model's table that is joined to the table of the model (set up using belongs_to method)?