title: How can i make my grades sort from highest to lowest and viceversa
body: <p>(Thats on grade controller.erb)</p>
  <pre><code>def index
    @grades = Grade.order(params[:sort] + '' + params[:direction])
  end
  </code></pre>
  <p>(index.html)</p>
  <pre><code>&lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;%= link_to &quot;Student&quot;, :sort =&gt;&quot; grade.student_id&quot;%&gt; &lt;/th&gt;
      &lt;th&gt;&lt;%= link_to &quot;Student name&quot;, :sort =&gt; &quot;grade.student_name&quot;%&gt;&lt;/th&gt;
      &lt;th&gt;&lt;%= link_to &quot;Student grade&quot;, :sort =&gt; &quot;grade.student_grade&quot;%&gt;&lt;/th&gt;
      &lt;th colspan=&quot;3&quot;&gt;&lt;/th&gt;
    &lt;/tr&gt;
  </code></pre>