respond_to do |format| format.html # index.html.erb format.xml { render :xml => @directories } end
<software>#<Software:0xb7046548></software>
The model directory belongs to a software instance.
respond_to do |format| format.html # index.html.erb format.xml { render :xml => @directories } end
<software>#<Software:0xb7046548></software>
The model directory belongs to a software instance.
What magic were you expecting to have happen? (Rails did exactly what you told it to).
Don't you want something like
format.xml { render :xml => @software.to_xml( :include => :directories ) }
If you want only @directories, then you should create an rxml template to be used under software, where you marshall the xml data is any old format you want.
for directory in @directories xml.directory do xml.directory_name(directory.name) etc etc end end
I want each directory as xml, just how it is...but the associated "software" object, I want to include that. What you wrote initially looks backwards to me.
since this is requested as directories.xml
<directory> .... <software version="<%= directory.software.version"><%= directory.software.name %></software> </directory>
It sounds like that's the only way to create an index.rxml file?
I figured there would be an automatic way to map associated models to the default xml output.