Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2811

update with nested attributes fails

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.1.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Hi there,

      I am observing an issue with update_attributes and mongoid master (upcoming 3.1) when model is accepting nested attributes for many embedded models.

      This is the document structure:

      project

      -> query
      -> query_atom
      -> query_atom
      ...

      This is the moped output when updating one query_atom's "identifier" by calling

      @query.update_attributes params

      3.0 (works):

      MOPED: 127.0.0.1:27017 UPDATE database=test collection=projects selector=

      {"_id"=>"5118eafa46f6d6b461000001"}

      update={"$set"=>{"query.updated_at"=>2013-02-11 12:58:34 UTC, "query.query_atoms.0.identifier"=>53}} flags=[] (0.8774ms)

      3.1 (doesn't work):

      MOPED: 127.0.0.1:27017 UPDATE database=test collection=projects selector=

      {"_id"=>"5118e6f146f6d6f0da000001", "query._id"=>"5118e6f146f6d6f0da000002"}

      update={"$set"=>{"query.updated_at"=>2013-02-11 12:41:21 UTC, "query.query_atoms.$.identifier"=>81}} flags=[] (0.4168ms)

      Any thoughts on what might be going on? I'd be happy to provide more details.

            Assignee:
            durran Durran Jordan
            Reporter:
            opahk opahk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: