I have an each statement in a view:
<tr><% @quantity.each do |hash| %>
<td><%= hash.map { |key, value| "Channel: #{key} Quantity: #{value} units" } %>
</td><% end %></tr>
which is rendering on the webpage with square brackets and inverted commas, thus:
[“Channel: 1 Quantity: 4675 units”]
[“Channel: 2 Quantity: 2864 units”]
The array of hashes that it’s looping round is this:
[{2=>2864}, {1=>4675}]
How do I stop the [” from showing up on the page?
Thanks!
mapmaps a hash into an array. The output is what it should be. Instead of usingmap, try:Should help.
Edit in response to your comment: