# Sorting order

**URL:** <https://www.ruby-forum.com/t/sorting-order/67245>\
**Category:** Radiant CMS\
**Created:** [September 1, 2006, 5:00pm UTC](https://www.ruby-forum.com/t/sorting-order/67245 "2006-09-01T17:00:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 1, 2006, 5:00pm UTC](https://www.ruby-forum.com/t/sorting-order/67245/1 "2006-09-01T17:00:43Z")

</div>

When using such code as

* * *

* * *

I can specify order=“asc” or order=“desc” but what if I want an  
arbitrary order? In the admin section, pages are ordered according to  
what I guess is the order of creation (page ID). I can not change the  
order itself (which would solve my problem).

Any idea?

Ollivier, full of questions today

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 1, 2006, 5:02pm UTC](https://www.ruby-forum.com/t/sorting-order/67245/2 "2006-09-01T17:02:44Z")

</div>

On 9/1/06, Ollivier R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When using such code as
> 
> * * *
> 
> * * *

Make that

* * *

\<r:children:each order=“desc”\>  
\<r:content /\>

* * *
-----

Sorry.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 1, 2006, 5:10pm UTC](https://www.ruby-forum.com/t/sorting-order/67245/3 "2006-09-01T17:10:44Z")

</div>

Ollivier,

You can specify by=“attribute” on the children:each tag, which lets you  
pick  
the attribute to sort by, which I’m assuming are any attributes of the  
Page  
model.

Sean C.  
[seancribbs.com](http://seancribbs.com)

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 1, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/sorting-order/67245/4 "2006-09-01T17:36:47Z")

</div>

On 9/1/06, Sean C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You can specify by=“attribute” on the children:each tag, which lets you pick  
> the attribute to sort by, which I’m assuming are any attributes of the Page  
> model.

Found that by looking at the code but…

I’m now getting repeatable ruby/mongrel crashes while rendering my  
pages. Only the “test” one but instant mongrel death with

zsh: illegal hardware  
instruction (core dumped) mongrel\_rails start -e  
production -B

I tried to put 1, 2, … in the “slug” attribute in the subpages and  
by=“slug” in the parent one.

it is like that:

test (slug=“test”)  
|  
±— FreeBSD (slug=“2”, title=“FreeBSD …”)  
| ----- body  
| ----- left  
| ----- main  
|  
±— Programs (slug=“1”, title=“Programs…”)  
----- body  
----- left  
----- main

## test is only

\<r:children:each by=“slug” order=“asc”\>  
\<r:content /\>

* * *
-----
## while body is

## 

-----

Any idea? Running on FreeBSD 6.1-RC1 on a D820 (dual core) system  
with Ruby 1.8.5 and mongrel 0.3.14.3.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 1, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/sorting-order/67245/5 "2006-09-01T23:25:36Z")

</div>

On 9/1/06, Ollivier R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m now getting repeatable ruby/mongrel crashes while rendering my  
> pages. Only the “test” one but instant mongrel death with
> 
> zsh: illegal hardware  
> instruction (core dumped) mongrel\_rails start -e production -B

With Ruby 1.8.4 on OS X but with the same 0.3.13.4 mongrel, it doesn’t  
crash like that but seems to recurse too deep because I get a message  
about that.

Any idea, should I revert to previous Ruby and/or mongrel?

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 8, 2006, 5:46pm UTC](https://www.ruby-forum.com/t/sorting-order/67245/6 "2006-09-08T17:46:30Z")

</div>

To those interested, I’ve found a solution after being hit on the head  
one time too much by the sentence “if the body page part is not found  
here, radiant will try to find it in the parent”…

It seems also to “fix” the ruby calls stack overflow caused by the way  
I did the thing before.

I now have a “parent page” with only this:

* * *

\<r:children:each by=“slug” order=“asc”\>

## 

* * *
-----

and all child pages have only “left” and “main” page parts, no “body”.  
And the by=“slug” allows me to the way _I_ want it.

Happy.
