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