title: How can I sort a list of ActiveRecords by an attribute length?
body: <p>I have an object like this:</p>
  
  <pre><code>irb(main):076:0&gt; hints = Hint.where("sentence LIKE ?","%你%")
    Hint Load (4.0ms)  SELECT "hints".* FROM "hints" WHERE (sentence LIKE '%你%')
  [
      [0] #&lt;Hint:0x007fb99c6520b8&gt; {
                  :id =&gt; 214,
            :sentence =&gt; "我为你们立下模范，我向你们怎样做，你们也该照样做。",
                :user =&gt; nil,
             :learned =&gt; nil,
          :created_at =&gt; Sun, 06 Jan 2013 18:14:33 UTC +00:00,
          :updated_at =&gt; Sun, 06 Jan 2013 18:14:33 UTC +00:00
      },
      [1] #&lt;Hint:0x007fb99c659a70&gt; {
                  :id =&gt; 229,
            :sentence =&gt; "他快要完成地上的传道工作时，曾向耶和华祷告说“我已经使他们使徒认识你的名，以后还要使他们认识”。",
                :user =&gt; nil,
             :learned =&gt; nil,
          :created_at =&gt; Sun, 06 Jan 2013 18:43:23 UTC +00:00,
          :updated_at =&gt; Sun, 06 Jan 2013 18:43:23 UTC +00:00
      },
      [2] #&lt;Hint:0x007fb99c659458&gt; {
                  :id =&gt; 234,
            :sentence =&gt; "你的王到你这里来了。",
                :user =&gt; nil,
             :learned =&gt; nil,
          :created_at =&gt; Sun, 06 Jan 2013 18:48:12 UTC +00:00,
          :updated_at =&gt; Sun, 06 Jan 2013 18:48:12 UTC +00:00
      }
  ]
  irb(main):077:0&gt; hints.class
  ActiveRecord::Relation &lt; Object
  </code></pre>
  
  <p>How can I sort by <code>sentence</code> length?</p>
  
  <p>My final goal is to make it so that when someone clicks on a Chinese character in a lesson that they will be shown a few of the shortest example sentences available as a hint to the meaning of the character.</p>
  
  <p>I am using PostgreSQL.</p>