Forum: Ruby on Rails Sorting has_many relationships

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
rails_list (Guest)
on 2005-11-12 13:49
(Received via mailing list)
Hi Railers!

I'm building a new website for our bar-foos-league (league for
foosball players who play in bars in Zurich, Switzerland ;-)

Being a bit of a noob when it comes to rails and web development in
general, I've come across a few questions. One concerns sorting of a
has_many relationship, for instance.

I've got a League model, which has_many TeamConfigs which in turn
belongs_to a Team object. A TeamConfig is basically the
representation of a Team for one season, so the name of the team is
an attribute of the Team model.

What I'd like to do is something like this:

class league
	has_many :team_configs, :order => ''

Of course, this doesn't work. So I'm wondering if I'm missing some
obvious way to do this, or if I have to sort my TeamConfigs with
ruby. Any insight would be much appreciated.

This topic is locked and can not be replied to.