Rails erb style background-image
<p>It's a simple question, but I just can't get the right result</p>

<p>The original html is </p>

<pre><code> &lt;section class="pageTitle" style="background-image:url(img/pages/page-title-bg8.jpg);"&gt;
</code></pre>

<p>But now I need to rewrite it into the version of <code>erb</code></p>

<p>I wrote the following code, but it fails.</p>

<pre><code>&lt;section class="pageTitle" style="background-image: url(&lt;%= image_url 'img/pages/page-title-bg8.jpg' %&gt;);"&gt;
</code></pre>

<h2>Update</h2>

<p>It becomes </p>

<pre><code>&lt;section class="pageTitle" style="background-image: url(http://localhost:3000/images/img/pages/page-title-bg8.jpg);"&gt;
</code></pre>