Deleting non-persisted embedded subdocuments

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • 12_01_17
    • Affects Version/s: 4.0.0 final
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi
      I have an embeds_many collection and I create a few items. The parent is still not saved (those new items show persisted? == false) and later I decide I want to remove them.
      I tried items.where(...).delete_all and {{new_items.each

      { |i| new_items.delete(i) }

      but both are running $pull queries.
      So my question is: is there a way to delete new (non-persisted) items from an embeds_many without hitting the database?
      Thanks

              Assignee:
              Unassigned
              Reporter:
              Marek Stanczyk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: