polymorphic associations ok in read but not in create...

Romain

I'm looking at AWDWR version 2 on page 347 in the section on Polymorphic Associations. It appears that you should be using has_one on your User and Secretary classes, as each User and Secretary is associated with exactly one Employee. (Employee has a one-to-one relationship with a User OR a Secretary, but not both, since a single foreign key (assignable_id) is polymorphically (re)used for both.

I think you need to create both sides of the association:

e = Employee.new(...) e.assignable = Secretary.new(...) e.save!

Patrick