codemy/writefully

View on GitHub
app/views/comments/_comments.html.erb

Summary

Maintainability
Test Coverage
<hr>
<h2>Comments</h2>
<% @post.comments.each do |comment| %>
  <div class='panel panel-default'>
    <div class='panel-body'>
      <%= comment.body %>
      <div class='author'>
        Commented by: <%= comment.user.email %>
      </div>
    </div>
  </div>
<% end %>

<%= form_for [@post, @post.comments.build] do |f| %>
  <div class='form-group'>
    <%= f.text_area :body, class: 'form-control' %>
  </div>
  <div class='actions'>
    <%= f.submit "Save", class: 'btn btn-success' %>
  </div>
<% end %>