Displaying 1 result from an estimated 1 matches for "sorted_families".
Did you mean:
sorted_familes
2006 Sep 21
3
:order by association field
...ould be a fairly common pattern,
but I''m currently not sure how.
BACKGROUND:
model Family has_one Father. also, Family has field "country_of_origin"
model Father has a number of fields, such as first_name, age, etc.
It''s easy to sort based on families'' fields:
sorted_families = Family.find(:all, :order => ''country_of_origin'')
But, how do I sort based on the fields of the child? For example, how
do I sort families based on the first name of the associated "father"
field? I.e.,
sorted_families = Family.find(:all, :order => ''fat...