I need to create an XML file output like:
<data>
<hour>0</hour>
<count>8</count>
</data>
.
.
<data>
<hour>23</hour>
<count>1</count>
</data>
I wrote the following code in my controller:
for @k in (0..23)
@data.push(Datum.new(@k,@freq[@k]));
end
class Datum
def initialize(hour, count)
@hour = hour
@count = count
end
end
render xml:@data
But the output comes out like:
tweet-densities-controller-data type="array">
<tweet-densities-controller-datum type="TweetDensitiesController::Datum">#
TweetDensitiesController::Datum:0xacbddc4></tweet-densities-controller-datum>