# Order of rooms

**URL:** <https://www.ruby-forum.com/t/order-of-rooms/152941>\
**Category:** Rails\
**Created:** [November 10, 2008, 10:01am UTC](https://www.ruby-forum.com/t/order-of-rooms/152941 "2008-11-10T10:01:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Janka](https://www.ruby-forum.com/u/Janka)\
**Post date:** [November 10, 2008, 10:01am UTC](https://www.ruby-forum.com/t/order-of-rooms/152941/1 "2008-11-10T10:01:37Z")

</div>

Hi,

I`ve got one trouble. I`ve got order of rooms(order by id), but I`m  
choosing available one, after that I would like to send the room,  
which was taken on the last place. Something like this I have:

1.room(id = 1) 2. room (id = 2) 3. room (id = 3) I will take first  
room, but after that I would like to have:  
2.room (id = 2) 3.room (id = 2) 1.room (id = 3), it doesn`t have to be  
id it might be rank or something like that.

I would appreciate if you could help.

Thank you Janka

---

<div class="post-metadata">

**Author:** ![Janka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Janka](https://www.ruby-forum.com/u/Janka)\
**Post date:** [November 10, 2008, 1:45pm UTC](https://www.ruby-forum.com/t/order-of-rooms/152941/2 "2008-11-10T13:45:15Z")

</div>

If you stick your rooms into an array, just pick out whichever room is  
selected, and push that room back onto the tail of the array.

---

<div class="post-metadata">

**Author:** ![Janka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Janka](https://www.ruby-forum.com/u/Janka)\
**Post date:** [November 10, 2008, 2:14pm UTC](https://www.ruby-forum.com/t/order-of-rooms/152941/3 "2008-11-10T14:14:15Z")

</div>

Thank you,

I will try it.
