Validation

Association with autosave option defines several callbacks on your model
(before_save, after_create, after_update). Please note that callbacks are
executed in the order they were defined in model. You should avoid
modifying the association content, before autosave callbacks are executed.
Placing your callbacks after associations is usually a good practice.

One-to-one Example

class Post < ActiveRecord::Base
has_one :author, autosave: true
end

Saving changes to the parent and its associated model can now be performed
automatically and atomically: