L
L
LoveCode &Coffe2019-09-20 03:55:19
Ruby on Rails
LoveCode &Coffe, 2019-09-20 03:55:19

How to embed ruby ​​in js?

I want to open a block with all the comments when I click on the button, how can I insert this code into js so that it works?

<h1>Все комментарии</h1>
<% @task.comments.each do |comment| %>
 <p><strong><%= comment.name %></strong> : <%= comment.description %> </p>
<% end %>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Paul, 2019-09-20
@terraplane

You need to wrap the comments in a common container, clicking on the button should control the visibility of the container.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question