Rails PostgreSQL sort by integer value of string
<p>I made a strategic mistake when developing database architecture on my Rails app</p>

<p>Now I have to implement sorting by price feature using </p>

<pre><code>MyModel.order('price DESC')
</code></pre>

<p><strong>price is a string</strong> type in the database, which cause 50 to be greater than 2000 for example</p>

<p>Are there any ways to implement such <code>.order()</code> without changing database structure?</p>

<p><strong>EDIT:</strong></p>

<p>I switched to correct type (integer) for price column. It took me an hour only to refactor.</p>