Forum: Ruby on Rails How can I order_by a sub folder?

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.
Mischa B. (Guest)
on 2006-02-14 11:35
(Received via mailing list)
Hi there!

I have a folder model which can contain sub-folders. I want to save the
sub-folders in a variable ordered by the name of the subfolders:

folder = Folder.find(1)
sub_folders = folder.folders  # ... how can I order the sub folders by
name
here???

Thanks,
Mischa.
Mischa B. (Guest)
on 2006-02-14 22:01
(Received via mailing list)
> folder = Folder.find(1)
> sub_folders = folder.folders  # ... how can I order the sub folders by name
> here???

Like this:
@folders = folder.folders.find(:all, :order => "name")
This topic is locked and can not be replied to.