> Is new_document.id a typo? Yes, sorry.
> The fact that you're getting the object_id does mean that > the object is not a model instance. That's what I don't understand. The database is assigning and id and returning it to rails. Rails is then trying to use this id to create the new_document_page, but I get Mysql foreign key errors because that id doesn't exist in the database. > Let AR take care of setting the foreign key: > document.pages.create!(:attribute2 => "etc...") if document.save I'll give that a shot, thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---