# Using Builders

**URL:** <https://www.ruby-forum.com/t/using-builders/186259>\
**Category:** Rails\
**Created:** [April 3, 2010, 3:32am UTC](https://www.ruby-forum.com/t/using-builders/186259 "2010-04-03T03:32:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RVince](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4491bb/32.png) [@RVince](https://www.ruby-forum.com/u/RVince)\
**Post date:** [April 3, 2010, 3:32am UTC](https://www.ruby-forum.com/t/using-builders/186259/1 "2010-04-03T03:32:09Z")

</div>

I am using RoR 2.3, and have installed the builder gem

I have a line in a view as follows:

str\_xml = render “fusioncharts/array\_example/ss\_array\_data.builder”,  
{:arr\_data =\> @arr\_data}

Which does not set str\_xml to anything.

I can confirm that in my controller I have @arr\_data set up and  
populated properly. (And in my controller, I have require ‘builder’  
at the top)

In my views folder, I have a folder set up under it as “fusioncharts/  
array\_example/” and the file ss\_array\_data.builder. (However, this may  
be why str\_xml is not being set – when I go to the URL which would  
invoke this view, I get “Missing template \_ss\_array\_data.builder in  
view path…” It will only render the page if I put the underscore  
before the filename ss\_array\_data.builder, making it a partial).

What am I not understanding about builders that I cannot convert my  
array @arr\_data to str\_xml ?

Thanks so much, RVince

---

<div class="post-metadata">

**Author:** ![RVince](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4491bb/32.png) [@RVince](https://www.ruby-forum.com/u/RVince)\
**Post date:** [April 3, 2010, 4:43am UTC](https://www.ruby-forum.com/t/using-builders/186259/2 "2010-04-03T04:43:35Z")

</div>

Here is the builder file:

xml = Builder::XmlMarkup.new  
xml.graph(:caption=\>‘Closing  
Ratios’, :numberPrefix=\>’’,  
:formatNumberScale=\>‘0’,:decimalPrecision=\>‘4’)  
do  
for item in arr\_data  
xml.set(:name=\>item[0], :value=\>item[1],:color=\>’’+get\_FC\_color)  
end  
end
