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

Behavior of :autosave not consistent with ActiveRecord

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

      According to the ActiveRecord docs, even when :autosave is not present on an association, saving a parent model saves its associated child models as well.

      What :autosave does, is to save them in the same transaction as the parent model:

      > Note that :autosave => false is not same as not declaring :autosave. When the :autosave option is not present new associations are saved.

      So I think even when :autosave => true is absent, Mongoid should still save the children. However when :autosave => false is specified, the children should not be automatically saved.

      As MongoDB does not support multi-collection transactions at the moment, :autosave => true should be identical to no :autosave at all.

            Assignee:
            Unassigned Unassigned
            Reporter:
            behrangsa behrangsa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: