# Sorting Index

**URL:** <https://www.ruby-forum.com/t/sorting-index/125033>\
**Category:** Rails\
**Created:** [January 4, 2008, 6:31pm UTC](https://www.ruby-forum.com/t/sorting-index/125033 "2008-01-04T18:31:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![edberner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f9ae1b/32.png) [@edberner](https://www.ruby-forum.com/u/edberner)\
**Post date:** [January 4, 2008, 6:31pm UTC](https://www.ruby-forum.com/t/sorting-index/125033/1 "2008-01-04T18:31:33Z")

</div>

Hi, I have a question about sorting a RESTful application.

On my index page there are several types of videos I would like to  
sort, ranging from new, to top rated and more, and beyond that I would  
like the user to, for example, sort the ratings from least to greatest  
and vice versa, or from most viewed to least viewed (and vice versa).  
To do so I made up two params in my link\_to  
e.g.  
:kind =\> “new”, :sort =\> “bottom” for whenever the user clicks  
these two scenarios.

In the controller I have if statements set up to handle each one with  
call to methods in the model depending on the scenario. I can’t help  
but just feel I’m going about this the wrong way.

Does this make sense what I’m trying to do and if so am I going about  
it the right way.
