Well, what I ended up doing was just sort of brute-forcing it. The
database models people, so I created a view template that would format
just one person at a time. Then looped through my list of people,
generating view code, gsubbed out the returns and line feeds, then
appended to my collective list with a newline:
result = ""
people.each do |person|
person_xml = render_to_string(:template -> 'blah/blah', :layout => false)
person_xml.gsub!("\r", " ")
person_xml.gsub!("\n", " ")
end
result += person_xml + "\n"
Then sent it out as text/plain with send_data()
-glenn
On Wed, Nov 23, 2011 at 11:05 AM, Glenn Little <[email protected]> wrote:
> I'm working with xml builder (.rxml view files) in a legacy rails2
> project. I'm trying to create an xml file that has a series of outer
> containers/elements, and within each some amount of nested xml
> elements.
>
> I'd like to only have newlines in between each outer element's xml.
> So basically I'd have a series of lines of text, one per outer
> element.
>
> I see in builder that I can control things like indent size and so on,
> but is there a way to control when newlines do and do not appear?
> Short of some sort of content-aware post-processing?
>
> Thanks...
>
> -glenn
>
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby