If I have a Person model that acts_as_tree, how can I find a
particular person by drilling down through the family tree?
e.g.
for this family:
John
| |
Amy Dave
| |
Bob Bob
The urls
/john/amy/bob and /john/dave/bob
should find a different Person object. At the moment, I am doing it
like this:
people = (params[:people])
people.each do |person|
if person == people.first
@person = Page.find_by_name(people.first)
else
@person = @person.children.find_by_name(person
end
end
This hits the database quite a few times though. Is there a better way
to drill down to find the people?
DAZ