I would like to understand how nested loops work each
.
Suppose I have a blog application with a model Article
and a model Comment
.
Quoting all my articles ...
- @articles.each do |article|
= article.text
The completion of all my comments ...
- @comments.each do |comment|
= comment.text
But what I really want is to skip all the comments of a particular article - this means that the second loop is nested inside the first.
How to achieve this?
Liroy source
share