Topic: Model associations prior to saving

I am putting together a UserGroup model.  When it is created, I want it to have some default things like a blog and a wiki.  So, in my UserGroup class, I have this:
[code=UserGroup.rb]has_many :blogs
has_many :wikis

def self.new(attributes = nil)
  ug = super(attributes)

  ug.blogs = []
  ug.blogs << Blog.new({:user_group => ug, :name => 'Default Blog'})

  ug.wikis = []
  ug.wikis << Wiki.new{(:user_group => ug, :name => 'Default Wiki'})

  return ug
end[/code]
And, it cascades further in the Wiki class, where a default page is created:
[code=Wiki.rb]belongs_to :user_group

def self.new(attributes = nil)
  w = super(attributes)

  w.pages = []
  w.pages << Page.new({:wiki => w, :name => 'Main Page', :body => 'Hello World!'})
  return w
end[/code]
Is this going to get me into trouble?  I'm debugging it right now, but I'm worried that I'm going about it totally wrong.  It worries me because I'm making associations between objects that are not yet in the database and it could cause problems because the id values are not yet set.

Is there a better way to do this?

If there is a post/website/blog entry/whatever that answers my questions, please don't hesitate to simply post a link.  I know it can get old fast to answer the same question hundreds of times...

Re: Model associations prior to saving

One solution I found was to add some after_create methods that do the same thing as what I had inside the new methods.  The after_create filters guarantee that they will be called immediately following the creation of the object, so I know that the blogs and wikis will be there like I intended.

If there is a post/website/blog entry/whatever that answers my questions, please don't hesitate to simply post a link.  I know it can get old fast to answer the same question hundreds of times...