title: Ruby - sort array of objects by attribute in descending order
body: <p>I have this Json array of objects</p>
  
  <pre><code>"students": [{
      "id": 1,
      "first_name": "John",
      "last_name": "Doe",
      "age": "14",
    }, {
      "id": 2,
      "first_name": "Victoria",
      "last_name": "Secret",
      "age": "9",
    }, {
      "id": 3,
      "first_name": "Jim",
      "last_name": "Morrison",
      "age": "16",
    }, {
      "id": 4,
      "first_name": "Jack",
      "last_name": "Daniels",
      "age": "7",
    },
    }]
  </code></pre>
  
  <p>I want to display them in my <code>index.html.erb</code> <strong>sorted by age</strong> in <strong>DESC</strong> order. I'm half way there, I have manage to sort them, however not in exact DESC order. This is my loop</p>
  
  <pre><code>&lt;% @classroom['students'].sort_by { |st| st['age'] }.each do |student| %&gt;
  </code></pre>
  
  <p>This is the result I want:</p>
  
  <pre><code>16,  Jim,     Morrison
  14,  John,    Doe
  9,  Victoria, Secret
  7,  Jack,     Daniels
  </code></pre>
  
  <p>This is what I get instead:</p>
  
  <pre><code>14,  John,    Doe
  16,  Jim,     Morrison
  7,  Jack,     Daniels
  9,  Victoria, Secret
  </code></pre>