Reading the docs for the `has_one` relation of ActiveRecord I found the option `ensuring_owner_was`<p>I didn't understand how to use it, so I looked for it on Github, but it doesn't seem very popular...<p>https://github.com/search?q=ensuring_owner_was+language%3ARuby+path%3Aapp%2Fmodels&type=code
Look at actual ruby docs, not github.<p><a href="https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_one" rel="nofollow">https://api.rubyonrails.org/classes/ActiveRecord/Association...</a>