title: Not able to convert this sql query into Rails?
body: <pre><code>select count(listings.price) 
  from generate_series(0,400) s(d) 
  left outer join listings listings 
  on (s.d &lt;= (listings.price/25000) and (listings.price/25000) &lt;= (1+ s.d))  
  group by s.d 
  order by s.d;
  </code></pre>