0

I have this code mentioned below and I am trying to make it work on a RoR application under haml extension. However I am getting unexpected keyword end. I read over the net and stackoverflow and found out that end is not required in HAML. However when I remove it I get an error saying that end keyword is expected. Could you please check and tip me what I am doing wrong? Thanks in advance.

<div id="comments">
<% @comments.each do |comment| %>
    <div class ="comment">
    <%= simple_format comment.content %>
</div>
<%end%>
</div>

What I did so far is:

%h1 Comments
 .comments
 - @comments.each do |comment|
 .comment
 = simple_format comment.content

Any clues? Thanks

1 Answer 1

3

Please note that haml is based on 2 space indentations. The correct haml version of your html is

#comments
  - @comments.each do |comment|
    .comment
      = simple_format comment.content
Sign up to request clarification or add additional context in comments.

1 Comment

@Bookies: please mark this answer as the solution and upvote it, if you like

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.