# Saving 2 dependent models in one form (one needs other's ID)

**URL:** <https://www.ruby-forum.com/t/saving-2-dependent-models-in-one-form-one-needs-others-id/136553>\
**Category:** Rails\
**Created:** [May 3, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/saving-2-dependent-models-in-one-form-one-needs-others-id/136553 "2008-05-03T15:14:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 3, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/saving-2-dependent-models-in-one-form-one-needs-others-id/136553/1 "2008-05-03T15:14:44Z")

</div>

I’ve got a problem with saving 2 dependent models in one form (one needs  
other’s id).  
Can anybody help?  
Details: [http://railsforum.com/viewtopic.php?id=17859](http://railsforum.com/viewtopic.php?id=17859)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 3, 2008, 4:16pm UTC](https://www.ruby-forum.com/t/saving-2-dependent-models-in-one-form-one-needs-others-id/136553/2 "2008-05-03T16:16:51Z")

</div>

On 3 May 2008, at 14:14, [s] wrote:

> I’ve got a problem with saving 2 dependent models in one form (one  
> needs other’s id).  
> Can anybody help?  
> Details: [http://railsforum.com/viewtopic.php?id=17859](http://railsforum.com/viewtopic.php?id=17859)

Don’t call your model transaction. An association called transaction  
will override a built in rails method which is used when saving a  
record.

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 5, 2008, 6:38am UTC](https://www.ruby-forum.com/t/saving-2-dependent-models-in-one-form-one-needs-others-id/136553/3 "2008-05-05T06:38:42Z")

</div>

maybe use a dummy interemediate value then ‘really’ save them [?]
