Find find company name and user name

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

On 28 Apr 2008, at 16:30, Shandy N. 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 array

Frederick C. wrote:

On 28 Apr 2008, at 16:30, Shandy N. 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 array

Actually, 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs