I'm having trouble printing out a simple for each comment loop with _.template.
<% _.each([comments], function(i) { %> <p><%= i %></p> <% }); %>
prints [object Object]
<% _.each([comments], function(i) { %> <p><%= JSON.stringify(i) %></p> <% }); %>
prints:
[{"comment":"Mauris quis leo at diam molestie sagittis.","id":263,"observation_id":25}]
What I've tried so far:
<% _.each([comments], function(i) { %> <p><%= i.comment %></p> <% }); %>
blank
<% _.each([comments], function(i) { %> <p><%= i.get('comment') %></p> <% }); %>
Uncaught TypeError: Object [object Array] has no method 'get'
<% _.each([comments], function(i) { %> <p><%= comment %></p> <% }); %>
blank
commentscontains? That's basically what's important here.commentsin an array? I would assume that it's already an array, right?