samedi 3 novembre 2018

why when I reply to a comment I can only see the answers of the first comment?

I am creating a rail comment system. I managed to create the comic with the comments. I manage to answer the first comment but when I want to answer the other comments the answer stores it in bdd but does not appear

Here is the display code

messages.each do |message| %>
        <p class="msg">
          <b class ="name"> <%= message.Name %></b>
          <%= message.Text %></p>
          <a href="#" class="reply" role="button" onclick="get_reponse(event)">Répondre</a>
          <% msgs = Msg.where(msgable_id: message.id, project_id: params[:id]) %>
          <p class="answer">
            <% msgs.each do |msg|%>
            <b class="name"><%= msg.Name %></b>
            <%= msg.Text %></br></p>
            <a href="#" type="submit" class="answer_reply" role="button">Répondre</a>
            <% end %>
            <form action="/reply/" method="POST" style="width:20vw;">
              <textarea rows="4" cols="50" name="Texte" style="width:20vw;height: 2vw;margin-top:1vw;"></textarea>
              <input type="hidden" name="id" value="<%= message.id %>" />
              <input type="hidden" name="id_project" value="<%= message.id %>" />
              <button type="submit" style="margin-bottom:1vw;">Envoyer</button>
            </form>
            <%
          end %>
          <% end %>




Aucun commentaire:

Enregistrer un commentaire