Topic: ways to sort data

Does anybody know how to sort data just from the controller, something like code below?  I just don't know what the values can be for order.  I want it alphabetical, but it would be nice to have a list of different ways to do it.

def index
    @sites = Site.find(:all, :order => 'something')
end

Thanks,

Dan

Re: ways to sort data

:order uses SQL, so you can use any SQL ordering syntax like 'something ASC' for ascending.

For more advance ruby sorting see Comparable.

Re: ways to sort data

As thabenksta said :order is what you want, dsee the api docs on find

http://api.rubyonrails.org/classes/Acti … ml#M000860