Hi,
Four tables: users, user_counties, uk_counties and us_counties.
Each user has many counties, and each county has many users, so I
decided to make user_counties a polymorph, so it can have counties
from different countries (each country requires a completely different
set of tables with a completely different set of properties, that’s
why there’s one table for uk_counties and one for us_counties, with
more to follow when more countries are supported). This would require:
class User…
has_many :counties, :through => user_counties #counties is the
imaginary table
end
class UserCounties
belongs_to :counties, :polymorphic => true
end
Is this possible? If not, can anyone think of a way around it other
than adding another table into the chain? And (bonus question… not
required, just for fun) what would the reverse relationship look like
(ie, how would uk_counties relate to users)?
-Nathan