title: How to parse a SQL string into rails Arel object
body: <p>After writing some large and complex SQL statements I asked sometime ago <a href="https://stackoverflow.com/questions/13885040/better-way-to-write-large-sqls-inside-rails-models">how could I do it in a better way with Rails</a>. However I ended up using Arel again, because I couldn't nest more conditions if I were calling "find_by_sql".</p>
  
  <pre><code>Questions.find_by_sql(HUGE_SQL).by_filter(:popular).order('created_at').limit(5)
  </code></pre>
  
  <p>My goals are:</p>
  
  <ul>
  <li>Organize sqls in separate files</li>
  <li>Convert those string sqls into Arel objects</li>
  <li>Nest this arel object with common reusable conditions like "limit, order, .." </li>
  </ul>
  
  <p>Thanks</p>