Answer the question
In order to leave comments, you need to log in
Ruby on Rails 3 + Mongoid. How to create forms for nested models?
Hello.
Let's say we have a User model and a Phone model. Phone has fields home, work, mobile, and something like that, and Phone is nested in User (embedded_in).
I am unable to render the form to create a new User so that the form has the fields from the nested Phone (i.e. the fields home, work, mobile, etc.).
So far, I have found a solution how to display and add Phone fields for an existing User.
But how to add them along with adding a new User?
I really hope for help. In the Google group Mongoid, no one answers, in IRC - too.
Thanks
Answer the question
In order to leave comments, you need to log in
With nested forms and mongoid , I had only one problem - for everything to work, it is necessary that new entities from the form in the array go to the server last. Plus _destroy was written to the database. And so now there is a project where there are three levels of nesting, and is there such that the parent model is persisted? => false . Everything seems to be ok)
The author, by the way, is actively working towards release 2.0, he promised on Monday the 17th, but apparently he does not have time. So far I'm using beta20 with a bunch of my patches, but you can already find rc5 on github . Try to update, mongoid.org has a haut upgrade, so I advise you to read it, a lot has changed) And the best part is, a lot has been fixed and optimized)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question