Reputation: 55293
This is what I'm doing right now:
"click .save-file": (e) ->
posts = Posts.find().fetch()
console.log post for post in posts
Which outputs:
Object {_id: "jMraqpqyAcHz9BCM4", title: "Post 1", position: 3}
Object {_id: "7dsT8RpsPZ3LfjisX", title: "Post 3", position: 2}
How can I modify the code above so that it outputs:
Post 1
3Post 3
2
Instead? (I think I have to do something like: "#{@title}\n\n#{@position}"
)
Upvotes: 0
Views: 35
Reputation: 9523
Try...
"click .save-file": (e) ->
posts = Posts.find().fetch()
for post in posts
console.log post.title
console.log post.position
Upvotes: 1
Reputation: 1395
I think what you need to use is "#{post.title}\n#{post.position}\n"
since @
references this
and you need to reference post
.
Upvotes: 1