"G‑d said to Noah: 'Enter the ark - you and all your household, for I have seen that you are righteous before me in this generation.'" (Gen. 7:1)

Why did G‑d have to repeat that He had seen that Noah was a righteous man in his generation (since it is already stated in 6:9)? G‑d may have feared that Noah would misinterpret the command to enter the ark together with all his immediate family. He might have thought:
a) that every family member would be saved due to his or her individual merit; in that case the Torah should not have addressed the command to build the ark to Noah in the singular;
b) he might have thought that his wife, children, and their respective wives were being saved because they had not yet reached the age of accountability.
If Noah had thought this he might have been tempted to invite all those of his friends who were young enough to share the ark with him in order to survive. Even if he had not done so on his own initiative, he might have wondered why all these youngsters were doomed to perish.

...any youngster who did not have a righteous father was caught in the sins of his father...

G‑d told Noah once more that He had found only him as a righteous person at that time in order to lay to rest any of the other ideas Noah might have had on the subject. He now understood that any youngster who did not have a righteous father was caught in the sins of his father, who was punished to die without issue.

The statement of our Sages that Jewish minors have a share in the world to come, whereas gentile minors do not (Kohelet Raba 4:1 and Avot deRabbi Natan 36:1) may be based on our verse. In Noah's generation everyone was considered an idolator and it was reasonable to assume that the children would take after their fathers. Noah, on the other hand, took a more optimistic view of the possible development of the minors. G‑d therefore had to tell him that he could not save any youngsters barring his own.

[Selected with permission from the five-volume English edition of "Ohr HaChaim: the Torah Commentary of Rabbi Chaim Ben Attar" by Eliyahu Munk.]