read
Mongoid document supports array
field. Mongoid array field is a ruby array
but it becomes quite complex to manage array field in rails forms.
I didn’t find anything matching on google as well on stackoverflow hence decided to dig into rails form helpers (form_for
, fields_for
).
Finally i am pleased to get it working as expected :)
In below example, product
can have multiple categories
:
Here is form code
Here is products controller code