Forum: Ruby on Rails Question regarding has_one and association_build

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Eric L. (Guest)
on 2009-05-05 20:48
(Received via mailing list)
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

class Post < ActiveRecord::Base
  has_one :author

  def after_initialize

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

Link to doc:

This topic is locked and can not be replied to.