Reputation: 151
I have a list like so
[
{"name": "ryan",
"age": "12",
"gender":"male"
},
]
And I have code to render each value in the hash in the list like so:
<div>
<% @list.each do |student| %>
<%= student.each do |k,v|%>
<p> <%=v%> </p>
<% end %>
<% end %>
</div>
I would expect each value (ryan, 12 , male) to be wrapped in the <p>
tag however, for some reason the first value Ryan does not get wrapped in the tag when looking at the DOM.
It can be seen that the <p>
tag is empty where Ryan should be. Why is this happening?
Upvotes: 0
Views: 253