Why can't we have embeds_many :foo, :map where the embeds is a list of non-homogenous maps?

This sounds like exactly what polymorphic_embed was designed to do:

Without the “type” field that that uses, it’s not possible to figure out which schema the results should be when retrieving a schema that says embeds_many

If you really care exclusively about writing these shapes, consider saying field :foos_and_bars, :map and then manually using Foo and Bar’s changesets to produce maps in cast_embed.

2 Likes