title: Rails: x.days.ago to "YYYY-MM-DD" into the html date attribute
body: <p>I need to transform:</p>
  
  <pre><code>2.days.ago
  </code></pre>
  
  <p>to </p>
  
  <pre><code>"2018-08-17"
  </code></pre>
  
  <p>and render it in the <code>&lt;div data-date="&lt;%= result %&gt;"&gt;</code>.</p>
  
  <p>What I have tried as per <a href="https://stackoverflow.com/questions/22255476/rails-formatting-date">Rails formatting date</a>:</p>
  
  <pre><code>&lt;div data-date="&lt;%= 2.days.ago.strftime('%Y-%m-%d') %&gt;"&gt;
  </code></pre>
  
  <p>and it rendered as:</p>
  
  <pre><code>&lt;div data-date="%Y-%m-%d"&gt;
  </code></pre>
  
  <p>Why?</p>