Good question! I just stumbled upon this surprise.
I think Rails will save or check new child entries when autosave is nil (by default).
In save_belongs_to_association(reflection)
, it looks like it only saves the related record if it is a new record or autosave
enabled .
saved = record.save(:validate => !autosave) if record.new_record? || (autosave && record.changed_for_autosave?)
I always found that the autosave option is a bit confusing / inconsistent ... But now we are probably stuck with it for reasons of backward compatibility ...
source share