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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs