I have this 2 tables in my DB:
room_type
+ id
+ adult_guess (int)
room
+ id
+ name
+ description
+ hotel_id
+ room_type_id
Now, I would like to do something like:
Room.find(:all, :conditions => "hotel_id = " + @hotel_id,
:order_by => "room_type.adult_guess ASC").each do |room|
end
I want to order my rooms by number of adult guess. How can I do that? I already set the relationships between rooms and room_types, I mean, I can do a
room.room_type.adult_guess
(if it helps on something).
Thank you