Forum: Ruby on Rails Order of rooms

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
929d3b9607d130de6665bb4815f7f1aa?d=identicon&s=25 Janka (Guest)
on 2008-11-10 10:01
(Received via mailing list)
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
D188e591eac11021329b8821a5f954c7?d=identicon&s=25 Ar Chron (railsdog)
on 2008-11-10 13:45
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.
929d3b9607d130de6665bb4815f7f1aa?d=identicon&s=25 Jana Bohmova (Guest)
on 2008-11-10 14:14
(Received via mailing list)
Thank you,

I will try it.
This topic is locked and can not be replied to.