Ruby on Rails 3 + Mongoid. How to create forms for nested models?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Assume we have a User model and model of Phone. In Phone there is a field home,work,mobile and and Phone attached to User (embedded_in).
I can't display the form to create a new User, so that the form field from the attached Phone (ie field home,work,mobile, etc.).
So far I've found the solution how to display and add the Phone field for an existing User.
But how to add them, along with adding a new User?
I hope to help. In the Mongoid Google group no one is answering in IRC too.
Thank you
by | 4 views

1 Answer

0 like 0 dislike
With nested forms and mongoid I have had only one problem — to make everything work you need to form the array of new entities was on the server last. Plus _destroy database was written. And now there is a project where three levels of nesting is such that the parent model persisted? => false. Everything seems OK)
The author, incidentally, is actively working towards release 2.0, promised on Monday the 17th, but apparently did not have time. While I use beta20 with a bunch of his patches, but on github, you can already find rc5. Try to be updated on there are HOWTO upgrade, identity suggest to read, a lot has changed) And best of all, many fixed and optimizirovan)

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
asked Mar 24, 2019 by goshakkk_reborn
110,608 questions
257,186 answers
27,978 users