Hi

I'm almost certain that I already asked, but I can't find it anywhere.

Let's say I have a table for geographic subsets, with country, region,
department and town in it. All in one table, because depending on the
country there is no region, but states, or something else, with
different depth level. And a geo type.

Let's say I have a leaders table, wich tells me who the leader of a
country/region/town is.

Something like

Geos
:id
:type_id
:parent
:name

geo_types
:id
:name

Leaders
:id
:name

geos_leaders
:id
:geo_id
:leader_id

Now, I want to know who is the leader of the 'region' a given town is in.

I first tried the Leader.something route. I then tried the
Geo.filter(:name => xxx).first.ancestors route, but I can't find
something that works.

Anyone has an idea ?

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to