title: How to use ruby code in coffeescript jquery when we want to select an object with dynamic id?
body: <p>Well, I know that's a common question and found a lot of advice how to do it but it doesn't work for me and I can't understand what's the matter.</p>
  
  <p><strong>index.html.slim</strong></p>
  
  <pre><code>- books.each do |book|
    .row class = "review_form" id = book.id
      .panel
        == render 'reviews/form', review: review, book: book
  </code></pre>
  
  <p><strong>book.js.coffee</strong></p>
  
  <pre><code>$('.row.review_form').hide()
    $('#new_review_button').on "click", -&gt;
      $('.row.review_form#&lt;%= book.id %&gt;').show()
      $('#new_review_button').hide()
    $('#cancel_review').on "click", -&gt;
      $(".row.review_form#&lt;%= book.id %&gt;").hide()
      $('#new_review_button').show()
  </code></pre>
  
  <p>According to instructions if you want to use ruby code in javascript you should use <em>&lt;%= ruby code %></em> as i'm doing here         <em>$('.row.review_form#&lt;%= book.id %>').show()</em> but nothing happens. It seems like when i write <em>&lt;%=</em> in brackets it changes into one string and js doesn't understand it's a selector with ruby code. What am I doing wrong? Please, help, I'm totally confused! >&lt;</p>