# Many-To-Many relation - Creating all models in the same form

**URL:** <https://www.ruby-forum.com/t/many-to-many-relation-creating-all-models-in-the-same-form/165307>\
**Category:** Rails\
**Created:** [April 11, 2009, 11:24pm UTC](https://www.ruby-forum.com/t/many-to-many-relation-creating-all-models-in-the-same-form/165307 "2009-04-11T23:24:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipecsl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@felipecsl](https://www.ruby-forum.com/u/felipecsl)\
**Post date:** [April 11, 2009, 11:24pm UTC](https://www.ruby-forum.com/t/many-to-many-relation-creating-all-models-in-the-same-form/165307/1 "2009-04-11T23:24:48Z")

</div>

Hello,

I want to create a screen similar to the delicious one, where you can  
assign tags dynamically

to the bookmarks, but I don’t have the tags neither the bookmark  
created before the submit, and

all approaches that i tried resulted in the following error:

“Cannot associate new records through ‘Bookmark#taggings’ on ‘#’.  
Both records must have an id in order to create the has\_many :through  
record associating them.”

Any body have an example or any insights about that?

I think my approach will be use a plugin for taggables models, but I  
want to understand how to do

this in case I have another kind of many-to-many.

Regards, Felipe L.

---

<div class="post-metadata">

**Author:** ![felipecsl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@felipecsl](https://www.ruby-forum.com/u/felipecsl)\
**Post date:** [April 11, 2009, 11:28pm UTC](https://www.ruby-forum.com/t/many-to-many-relation-creating-all-models-in-the-same-form/165307/2 "2009-04-11T23:28:19Z")

</div>

On Apr 11, 10:10 pm, Felipe L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> all approaches that i tried resulted in the following error:
> 
> “Cannot associate new records through ‘Bookmark#taggings’ on ‘#’.  
> Both records must have an id in order to create the has\_many :through  
> record associating them.”
> 
> Any body have an example or any insights about that?

It was limitation of has many through until rails 2.1

Fred

---

<div class="post-metadata">

**Author:** ![felipecsl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@felipecsl](https://www.ruby-forum.com/u/felipecsl)\
**Post date:** [April 12, 2009, 4:56am UTC](https://www.ruby-forum.com/t/many-to-many-relation-creating-all-models-in-the-same-form/165307/3 "2009-04-12T04:56:58Z")

</div>

should be update rails my approach?

should it start working after an update?
