{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":{"state":"open","open_issues":5,"url":"https://api.github.com/repos/mongoid/mongoid/milestones/29","due_on":"2011-11-14T08:00:00Z","description":"","title":"2.3.4","number":29,"creator":{"avatar_url":"https://secure.gravatar.com/avatar/6f09262a13427532461b0b618d445b1e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6f09262a13427532461b0b618d445b1e","url":"https://api.github.com/users/durran","login":"durran","id":9030},"closed_issues":0,"created_at":"2011-10-25T11:31:09Z"},"user":{"avatar_url":"https://secure.gravatar.com/avatar/cee837a96382d466517f02d7b7026961?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"cee837a96382d466517f02d7b7026961","url":"https://api.github.com/users/digitalplaywright","login":"digitalplaywright","id":606207},"labels":[{"name":"bug","color":"e10c02","url":"https://api.github.com/repos/mongoid/mongoid/labels/bug"},{"name":"confirmed","color":"e10c02","url":"https://api.github.com/repos/mongoid/mongoid/labels/confirmed"}],"updated_at":"2011-10-30T12:27:05Z","assignee":null,"comments":11,"closed_at":null,"url":"https://api.github.com/repos/mongoid/mongoid/issues/1301","body":"I am still experiencing a problem with embedded fields of the same polymorphic type. In the example below only 'i_am_a'  is written to. The values of 'i_love_to' is incorrectly added to 'i_am_a'.\r\n\r\nIn addition to the minimal example below I  have created a github repository with a rails program that embeds the example in case you want to try it out:\r\n   git@github.com:digitalplaywright/bug.git\r\n\r\nPlease let me know if you are able to reproduce it.\r\n\r\nThis is a minimal example of the problem (as shown in the git repository above):\r\n\r\n```ruby\r\nclass TagInteraction\r\n  include Mongoid::Document\r\n  include Mongoid::Timestamps\r\n\r\n  field :name, :type => String\r\n  field :random_num_id, :type => String\r\n  field :status, :type => Symbol\r\n\r\n  embedded_in :tag_interactable, :polymorphic => true\r\nend\r\n\r\nclass Profile\r\n  include Mongoid::Document\r\n\r\n  embeds_many :i_am_a,    :class_name => 'TagInteraction', :as => :tag_interactable\r\n  embeds_many :i_love_to, :class_name => 'TagInteraction', :as => :tag_interactable\r\n\r\n  def find_bug\r\n     self.i_am_a    << TagInteraction.new(random_num_id: 'test_id', name: 'person', status: :add)\r\n     self.i_love_to << TagInteraction.new(random_num_id: 'test_id', name: 'dance', status: :add)\r\n\r\n     save\r\n     reload\r\n\r\n  end\r\nend\r\n```\r\n\r\n```ruby\r\n= Profile.create\r\n\r\n= p = Profile.first\r\n= p.find_bug\r\n\r\n= p.i_am_a\r\n=> [#<TagInteraction _id: 4e840c81b6619e7e34000012, _type: nil, created_at: 2011-09-29 06:13:21 UTC, updated_at: 2011-09-29 06:13:21 UTC, name: \"person\", random_num_id: \"test_id\", status: :add>, #<TagInteraction _id: 4e840c81b6619e7e34000013, _type: nil, created_at: 2011-09-29 06:13:21 UTC, updated_at: 2011-09-29 06:13:21 UTC, name: \"dance\", random_num_id: \"test_id\", status: :add>]\r\n\r\n= p.i_love_to\r\n=> []\r\n```\r\n\r\nMongoid outputs this on the shell:\r\n\r\n```\r\nMONGODB mongo_development['profiles'].find({}).sort([[:_id, :asc]])\r\nMONGODB mongo_development['profiles'].update({\"_id\"=>BSON::ObjectId('4e840cb4b6619e7e34000014')}, {\"$pushAll\"=>{\"i_am_a\"=>[{\"random_num_id\"=>\"test_id\", \"name\"=>\"person\", \"status\"=>:add, \"_id\"=>BSON::ObjectId('4e840cb4b6619e7e34000015'), \"updated_at\"=>2011-09-29 06:14:12 UTC, \"created_at\"=>2011-09-29 06:14:12 UTC}]}})\r\nMONGODB mongo_development['profiles'].update({\"_id\"=>BSON::ObjectId('4e840cb4b6619e7e34000014')}, {\"$pushAll\"=>{\"i_am_a\"=>[{\"random_num_id\"=>\"test_id\", \"name\"=>\"dance\", \"status\"=>:add, \"_id\"=>BSON::ObjectId('4e840cb4b6619e7e34000016'), \"updated_at\"=>2011-09-29 06:14:12 UTC, \"created_at\"=>2011-09-29 06:14:12 UTC}]}})\r\n```","html_url":"https://github.com/mongoid/mongoid/issues/1301","title":"two embeded fields of same type treated as one","number":1301,"id":1772496,"created_at":"2011-09-29T07:30:56Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/3d925b45ac07ec0ae5bd04888f6c5b61?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"3d925b45ac07ec0ae5bd04888f6c5b61","url":"https://api.github.com/users/dblock","login":"dblock","id":542335},"updated_at":"2011-10-30T12:27:05Z","url":"https://api.github.com/repos/mongoid/mongoid/issues/comments/2569338","body":"+1, this used to work in 2.0.2 and the example in the bug is ditto what we have (didn't test with the current HEAD)","id":2569338,"created_at":"2011-10-30T12:27:05Z"}}