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

_destroy with accepts_nested attribute only work when _destroy key is a symbol, not when it's a string

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

      Trying to delete an embedded object using the _destroy attribute doesn't work for nested attributes when using "_destroy", but it will work with :_destroy

      This will not delete the comment:

      article.update_attributes(comments: [{"_id" => ..., "_destroy" => "1"}])
      

      This will work, however:

      article.update_attributes(comments: [{"_id" => ..., :_destroy => "1"}])
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            evansagge Evan Sagge
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: