Hey guys,
I have a quick question about xml.builder rendering in Rails. I’m
pretty sure I am just getting the builder syntax wrong.
The problem is that I can’t get it to display things that I want
rendered out. By looking at the logs it seems like Rails has found
everything, but my syntax for displaying is wrong, so it displays
nothing.
I would like to display for example,
post.title
post.author
post.body
That’s all wrapped in a for loop, that should display all the posts. I
did a respond to xml in the controller, and I defined all my variables
correctly. However, I’m getting a blank screen.
What’s the equivalent of <%= %> in xml.builder syntax?
Thank you
David Z. wrote in post #961692:
Hey guys,
I have a quick question about xml.builder rendering in Rails. I’m
pretty sure I am just getting the builder syntax wrong.
The problem is that I can’t get it to display things that I want
rendered out. By looking at the logs it seems like Rails has found
everything, but my syntax for displaying is wrong, so it displays
nothing.
I would like to display for example,
post.title
post.author
post.body
That’s all wrapped in a for loop, that should display all the posts. I
did a respond to xml in the controller, and I defined all my variables
correctly. However, I’m getting a blank screen.
What’s the equivalent of <%= %> in xml.builder syntax?
http://builder.rubyforge.org/
But consider not using Builder. Haml works just as well for XML as it
does for HTML, as does ERb (though it’s less pleasant than Haml). I
find Builder to be more trouble than it’s worth in many cases.
Thank you
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]