OK, so I had the same problem, and I thought I just came across a solution (I checked the code for the metadata for the relationships ).
Try the following:
class Blog embeds_many :themes, :as => :themes_collection, :class_name => "Theme" embeds_one :theme, :as => :theme_item, :class_name => "Theme" end class Theme embedded_in :themes_collection, :polymorphic => true embedded_in :theme_item, :polymorphic => true end
I have discerned , which suggested that:
- the first parameter (for example
:themes
) actually becomes the name of the method. :as
fakes the actual relationship, so it is imperative that they match in both classes.:class_name
seems pretty obvious, the class used to serialize data.
Hope this helps - I'm obviously not an expert on internal work on a mangoid, but that should be enough for you to work. My tests are now green and the data is being serialized as expected.
source share