MRJ is right: leave the id handling to rails. but that goes for both Page and Document.
document = Document.new(:attribute => 'value') # set all attributes except :id, :project_id, :created_at, :updated_at project.documents << document page = Page.new(:attribute => 'value') # same thing here document.pages << page that's it. the only thing have to do to make this work is setting your relationships right: class Project < ActiveRecord::Base has_many :documents end class Document < ActiveRecord::Base has_many :pages belongs_to :project end class Page < ActiveRecord::Base belongs_to :document end hope this helps dominik --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---