title: Ransack custom sort_link record has_comments boolean value
body: <p>Having 2 models which Town and Comment.</p>
  <p><strong>Model Setup:</strong></p>
  <pre><code>class Town &lt; ApplicationRecord
    has_many :comments, as: :commentable
  end
  
  class Comment &lt; ApplicationRecord
    belongs_to :commentable, polymorphic: true, counter_cache: true
  end
  </code></pre>
  <p><strong>Example of Town Information Table:</strong></p>
  <p><a href="https://i.stack.imgur.com/wNTql.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wNTql.png" alt="enter image description here" /></a></p>
  <p><strong>To do:</strong></p>
  <ul>
  <li>Want to add sort link to &quot;Has Comments&quot;.</li>
  <li>All &quot;True&quot; would be at the beginning of the table, and use the code for asc/desc sort.</li>
  <li>All &quot;False&quot; would be at the end of the table, and use the code for asc/desc sort.</li>
  </ul>
  <p><strong>Sample on what result need when sort by asc/desc:</strong></p>
  <p><a href="https://i.stack.imgur.com/MygzN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MygzN.png" alt="enter image description here" /></a></p>
  <p>In case there was only &quot;true&quot; or &quot;false&quot; in the record will still follow the code for asc/desc order</p>
  <p><strong>What i have so far:</strong></p>
  <pre><code>class Town &lt; ApplicationRecord
    scope :sort_by_comments_and_code_asc, -&gt; { order('towns.comments_count DESC, towns.code ASC') }
    scope :sort_by_comments_and_code_desc, -&gt; { order('towns.comments_count DESC, towns.code DESC') }
  end
  </code></pre>
  <p><strong>Problem in my current code:</strong></p>
  <p>I don't really need to sort the comments_count. I just want is that all town that has comments would be at the beginning of table, town that has no comments would be at the end. Because it leads to this.</p>