# Alphabetically ordering

**URL:** <https://www.ruby-forum.com/t/alphabetically-ordering/109653>\
**Category:** Rails\
**Created:** [July 17, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/alphabetically-ordering/109653 "2007-07-17T16:10:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gearoid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9f8e36/32.png) [@gearoid](https://www.ruby-forum.com/u/gearoid)\
**Post date:** [July 17, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/alphabetically-ordering/109653/1 "2007-07-17T16:10:31Z")

</div>

Hey -

Need a hand with a straight forward problem…

I have names of systems stored in a table and I want the user of the  
application to be able to have it ascending or descending  
alphabetically. Is this possible using pagination?

Thanks in advance,  
Gearoid.

---

<div class="post-metadata">

**Author:** ![gearoid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9f8e36/32.png) [@gearoid](https://www.ruby-forum.com/u/gearoid)\
**Post date:** [July 17, 2007, 4:25pm UTC](https://www.ruby-forum.com/t/alphabetically-ordering/109653/2 "2007-07-17T16:25:28Z")

</div>

Yes, it’s possible. One way to do it is to make sure you pass your  
sort column and order to the pagination links, then pass these params  
back to find in the controller.

On Jul 17, 10:10 am, Gearoid G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![gearoid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9f8e36/32.png) [@gearoid](https://www.ruby-forum.com/u/gearoid)\
**Post date:** [July 17, 2007, 4:27pm UTC](https://www.ruby-forum.com/t/alphabetically-ordering/109653/3 "2007-07-17T16:27:49Z")

</div>

removed\_email\_address@domain.invalid wrote:  
Thanks for the reply. I’ll give it a shot.

---

<div class="post-metadata">

**Author:** ![gearoid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9f8e36/32.png) [@gearoid](https://www.ruby-forum.com/u/gearoid)\
**Post date:** [July 17, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/alphabetically-ordering/109653/4 "2007-07-17T16:37:10Z")

</div>

order = ( params[:order] == “desc” ? “ASC” : “DESC” )

paginate :systems, :order =\> “name #{order}”

Gearoid G. wrote:

> I have names of systems stored in a table and I want the user of the  
> application to be able to have it ascending or descending  
> alphabetically. Is this possible using pagination?
