title: How to save embeds_many relation in Mongoid?
body: <pre><code>class Hotel
    include Mongoid::Document
  
    field :title, type: String
  
    embeds_many :comments
  end
  
  class Comment
    include Mongoid::Document
  
    field :text, type: String
  
    belongs_to :hotel
  
    validates :text, presence: true
  end
  
  h = Hotel.create('hotel') 
  
     =&gt; &lt;#Hotel _id: 52d68dd47361731d8b000000, title: "hotel"&gt;
  
  c = Comment.new(text: 'text')
  
     =&gt; &lt;#Comment _id: 52d68f3d7361731d8b040000, text: "text", hotel_id: nil&gt;
  
  h.comments &lt;&lt; c
  
     =&gt; [#&lt;Comment _id: 52d68f3d7361731d8b040000, text: "text", hotel_id: nil&gt;]
  h.save
  
     =&gt; true
  Hotel.last.comments
  
     =&gt; []
  </code></pre>
  
  <p>variant 2</p>
  
  <pre><code>h.comments &lt;&lt; Comment.new(text: 'new', hotel_id: h.id)
  
     =&gt; [&lt;#Comment _id: 52d68f3d7361731d8b040000, text: "text", hotel_id: nil&gt;, &lt;#Comment _id: 52d691e17361731d8b050000, text: "new", hotel_id: BSON::ObjectId('52d68dd47361731d8b000000')&gt;]
  
  h.save
  
     =&gt; true
  Hotel.last.comments
  
     =&gt; []
  </code></pre>