How to replace the last "/" with a dash in a URL
<p>I have this URL in a Sinatra-based application:</p>

<pre><code>&lt;li&gt;&lt;a href="/blog/&lt;%= blog.title.tr(' ', '-') %&gt;/&lt;%= blog.slug %&gt;"
             method="get"&gt;Show&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>When I click on it, the URL looks like this:</p>

<pre><code>http://127.0.0.1:9292/blog/A-lovely-day/654790
</code></pre>

<p>I am trying to make the last <code>/</code> also a <code>-</code> too, so it will be:</p>

<pre><code>http://127.0.0.1:9292/blog/A-lovely-day-654790
</code></pre>

<p>How do I replace it after the URL has been rendered? </p>