Question regarding has_one and association_build

In the doc, there’s is a note saying association_build “only works if
an association already exists. It will NOT work if the association is
nil.” But in my test, it works fine when the association is nil. For
example,

class Post < ActiveRecord::Base
has_one :author

def after_initialize
build_author
end
end

This works perfectly for me. So is the warning in the doc something I
should be worried about?

Link to doc:

Thanks,
Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs