HTML/ embedded Ruby word count code input

this is a comment page of a school curriculum grading system. I want to do this:
1. Count the number of words in each comment
2. When the whole loop is over, count out the total number of words of all comments

< div id= "header" >
< H1 > Course Rating Information < / H1 >


Number:
<% = @ course.number% >



Year:
<% = @ course.year% >



Name:
<% = @ course.name% >

<strong>Commenter:</strong> <%= comment.commenter %>

<strong>Comment:</strong> <%= comment.comment %>

< end >
< else >
< H2 > No ratings available < / H2 >
< end >
< / div >
< div id= "footer" >
<% = link_to "New Comment", new_course_comment_path (@ course) >

<% = link_to "Back to course listing", courses_path% >
< / div >


@ course.comments.sum {| cc | cc.comment.length}

Menu