Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2><%= @post.title %></h2>
- <p><%= @post.body %></p>
- <hr>
- <%= link_to "Edit", edit_post_path(@post), :class => 'btn btn-default' %>
- <%= link_to "Delete", post_path(@post), method: :delete,
- data: {confirm: 'Are you sure?'},
- :class => 'btn btn-danger' %>
- <hr>
- <h3>Comments</h3>
- <% @post.comments.each do |comment| %>
- <div class="well">
- <p><strong><%= comment.username %></strong>: <%= comment.body %></p>
- </div>
- <% end %>
- <h3>Add Comment</h3>
- <%= form_for([@post, @post.comments.build]) do |f| %>
- <p>
- <%= f.label :username %><br>
- <%= f.text_field :username, class: 'form-control' %>
- </p>
- <p>
- <%= f.label :body %><br>
- <%= f.text_field :body, class: "form-control" %>
- </p>
- <p>
- <%= f.submit class: 'form-control' %>
- </p>
- <% end %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement