Is it possible to implement a model where:
Exit is polymorphic and can be of type: Door, Window, FootPath
and
Rooms are related through Exits with eachother.
I figured out that I would implement polymorphic exits, and on top of that I will use the through model, so the models' definitions look like:
class Room has_many :exits, has_many :rooms, through :exits
class Exit belongs_to :resource, :polymorphic => true belongs_to :room
class Door has_one :exit_entry, :as => :resource
class Window has_one :exit_entry, :as => :resource
class FootPath has_one :exit_entry, :as => :resource
Also Im not sure what foreign key refering to Room should be in Exit? I quess I should have something like: origin_room_id goto_room_id but on the other hand the :through model requires, that there is room_id
So overall any help on all that anyone?