I know that it will save associations when autosave: true
as per https://api.rubyonrails.org/classes/ActiveRecord/AutosaveAssociation.html
Not sure if this will help anyone else, but I recently ran into a similar issue recently in Rails 5.2.
When trying to save an object 2 layers deep my tests failed if the top level and the first level objects had already been saved. Ie.
book_cover.persisted? == true
book_cover.book.persisted? == true
page = book_cover.book.pages.new
page.persisted? == false
# After saving the top level object
book_cover.save
page.persisted? == false
# After saving the immediate parent of page
book_cover.book.save
page.persisted? == true
Since the parent "book cover" wasn't the direct parent of the new object "page" saving "book cover" didn't actually end up saving the "page" object.
Depending on the situation I just explicitly called save on the "book" object to save all the child objects.