I have this list of registered users which I find by a find statment in
my controller:
@users = User.find( :all, :conditions => [''approved = ?'',
true],
:order => ''company ASC'')
Then in my view I run through this array and get all the registered
users for each company and print them out in a nice, easy to read list.
I am order in ascending order by company, but I would also like to order
the users for each company in ascending order as well. I am not exactly
sure where to start with this. I think this might be a hashing issues
but I am not really sure. In line with that thinking, does the above
find save "stuff" in a hash or a strait forward array? Any
suggestions?
Thanks,
-S
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 28 Apr 2008, at 16:30, Shandy Nantz wrote:> > I have this list of registered users which I find by a find statment > in > my controller: > > @users = User.find( :all, :conditions => [''approved = ?'', true], > :order => ''company ASC'') > > Then in my view I run through this array and get all the registered > users for each company and print them out in a nice, easy to read > list. > I am order in ascending order by company, but I would also like to > order > the users for each company in ascending order as well. I am not > exactly > sure where to start with this.Is :order => ''company asc, name asc'' what you mean> I think this might be a hashing issues > but I am not really sure. In line with that thinking, does the above > find save "stuff" in a hash or a strait forward array? Any > suggestions? > Thanks,It returns an array --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 28 Apr 2008, at 16:30, Shandy Nantz wrote: > >> list. >> I am order in ascending order by company, but I would also like to >> order >> the users for each company in ascending order as well. I am not >> exactly >> sure where to start with this. > > Is :order => ''company asc, name asc'' what you mean > >> I think this might be a hashing issues >> but I am not really sure. In line with that thinking, does the above >> find save "stuff" in a hash or a strait forward array? Any >> suggestions? >> Thanks, > > It returns an arrayActually, that does exactly what I want, I just thought that it wouldn''t be that simple. I guess I fugured that trying to order on two fields might cause some issues with order under one company and there order under and different company, but I guess not. Thanks for your help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---