My SQL result @products=Product.find_by_sql() gives me this (
ID title, user_name
1 Product1 Xpeper
1 Product1 John
2 Product2 Xpeper
How can I build XML in my xml.builder view file so the source bould be like this
<products>
<product>
<id>1</id>
<title>Product1</title>
<users>
<user>Xpeper</user>
<user>John</user>
</users>
</product>
<product>
<id>2</id>
<title>Product2</title>
<users>
<user>Xpeper</user>
</users>
</product>
</products>
I would like to group items by products. Thx!