Polymorphic Nested Attributes In 2.3

Has anyone had any experience of using nested attributes with
polymorphic associations ? I cannot see how it would work as the
model would need to know the class of the object to create (when
creating a new record for the association).

Here is an example

class MyClass < ActiveRecord::Base
belongs_to :owner, :polymorphic=>true
accepts_nested_attributes_for :owner
end

This generates a method called ‘owner_attributes=’ which is fair
enough, but it does not generate the method ‘build_owner’ which is
required by the looks of it.

So, if I try using owner_attributes=, then straight away it complains
that the method build_owner is missing.

Regards

Gary Taylor

If MyClass belongs to your :owner model, wouldn’t the :owner model be
the one that accepts nested attributes for MyClass?