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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.1.3
    • Component/s: None
    • Labels:
      None

      Description

      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"}])
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: