> On Jan 19, 2018, at 7:37 PM, fugee ohu <fugee...@gmail.com> wrote: > > can create person objects with Adress.....person.new but if I'm creating a > new person object from @person from a form, how do i create the entry to the > relationships table since I don't have @person.id yet > >
You don't need to do that -- Rails cleans up those values for you when it saves the parent. So if you have @user = User.new(user_params) @widgets = @user.widgets.build(widget_params) When you save @user, the @widgets will be saved as well, and the correct ID will be put into each of the @widgets. Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/FC86BEF0-7C83-4C15-9F4A-0250E76C8C9C%40wdstudio.com. For more options, visit https://groups.google.com/d/optout.