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: 
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M001790

Thanks,
Eric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to