Format.xml not rendering associated model properly

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @directories }
end

#Software:0xb7046548

The model directory belongs to a software instance.


Anthony E.
408-656-2473
http://anthony.ettinger.name

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

On Sep 26, 9:27 am, Ar Chron [email protected] wrote:

end

Posted viahttp://www.ruby-forum.com/.

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.name %>

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.