I have a model User. User has_one Profile. Profile has a field first_name.
I want to get users from User table, ordered by his first_name (which is a field in Profile table). Is it possible? how do i do it?
Thanks Unni
I have a model User. User has_one Profile. Profile has a field first_name.
I want to get users from User table, ordered by his first_name (which is a field in Profile table). Is it possible? how do i do it?
Thanks Unni
@users = User.find(:all, :include => [:profile], :order => "profiles.first_name")
should work
thanks. it worked.