The setup: class Location::Base < ActiveRecord::Base set_table_name :locations ... end class Location::Address < Location::Base ... end class Location::Airport < Location::Base ... end class Person < ActiveRecord::Base belongs_to :location, :polymorphic => true, :class_name => "Location::Base" ... end
I want a unidirectional belongs_to relationship. That is, Locations are never going to need to figure out who's at them. Or, more specifically, the headache involved with the many-to-many and the caching and everything isn't worth the cost. I just want to be able to store a location for a Person (and for various other models that are unrelated to Person).
Some questions:
Why does Person need both a location_id and a location_type? In order to instantiate the location, it needs to look up the whole row in the locations table, which includes a "type" column (as required by single table inheritance).
Why won't the new sexy fixtures work on this (regardless of whether Person has a location_type column)? They seem to work only if Location::Base has_one :person.
-Gaius