<h1><%= @question.title %></h1>
<p><%= @question.body %></p>
<br>
  <a href="/questions/<%= @question.id %>/edit">Edit Question</a>
<h2>Answers:</h2>
<% if @question.answers %>
  <ul>
  <% @question.answers.each do |answer| %>
    <li><%= answer.text %></li>
  <% end %>
</ul>
<% end %>

<% if @errors %>
  <h4>Errors:</h4>
  <ul>
    <% @errors.each do |error| %>
      <li style="color: red;"><%= error %></li>
    <% end %>
  </ul>
<% end %>

<form method="POST" action="/questions/<%= @question.id %>/answers/new">
<input type = "hidden" name = "answer[question_id]" value = "<%= @question.id %>">
<textarea rows = '4' cols = '50' name="answer[text]" placeholder = 'Write your answer here'></textarea>
<br>
<input type = "submit" value = "Submit Answer">
</form>


<h1><%= @question.title %></h1>
<p><%= @question.body %></p>
<br>
  <a href="/questions/<%= @question.id %>/edit">Edit Question</a>
<h2>Answers:</h2>
<% if @question.answers %>
  <ul>
  <% @question.answers.each do |answer| %>
    <li><%= answer.text %></li>
    <a href="#"><%= answer.user.username %></a><br>
    <a href="/answers/<%= answer.id %>/edit">Edit</a>
    <a><form method="POST" action="/answers/<%= answer.id %>">
      <input type="hidden" name="_method" value="delete">
      <button type="submit">Delete</button>
    </form></a>
    <br>
  <% end %>
</ul>
<% end %>

<%= erb :_errors %>

<form method="POST" action="/questions/<%= @question.id %>/answers/new">
<input type = "hidden" name = "answer[question_id]" value = "<%= @question.id %>">
<textarea rows = '4' cols = '50' name="answer[text]" placeholder = 'Write your answer here'></textarea>
<br>
<input type = "submit" value = "Submit Answer">
</form>


Add links for username, editing, deleting and refactor errors
Add links for username, editing, deleting and refactor errors
