2

I'm using activeadmin 0.6.1, mongoid 3.1.5, and activeadmin-mongoid 0.3.0. embeds_many relations are arguably the best thing about mongoid, reducing the need for additional queries to fetch related data.

But I can't find a good way to make them work with activeadmin's f.has_many form helper (and activeadmin-mongoid doesn't seem to provide a f.embeds_many version).

The best solution I've come up with so far is to use a has_many relation, and use mongoid-alize to denormalize the has_many fields into the parent object. But this is somewhat unwieldy, as it requires me to access them as parent.children_fields instead of parent.children, which interferes with any code that expects an array of child objects instead of an array of attribute hashes.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.