# HABTM and order by

**URL:** <https://www.ruby-forum.com/t/habtm-and-order-by/150015>\
**Category:** Rails\
**Created:** [October 2, 2008, 2:43pm UTC](https://www.ruby-forum.com/t/habtm-and-order-by/150015 "2008-10-02T14:43:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vanight](https://www.ruby-forum.com/u/vanight)\
**Post date:** [October 2, 2008, 2:43pm UTC](https://www.ruby-forum.com/t/habtm-and-order-by/150015/1 "2008-10-02T14:43:24Z")

</div>

Hi,

I have 2 types A (HABTM B) and B (HABTM A).

So I’m trying to get List of Bs belonging to A

A.Bs

but I’d like to get them ordered by B’s name.  
How can I ordered this array of Bs.

Thanks
