# Accepts\_nested\_attributes\_for - objects are ignored:

**URL:** <https://www.ruby-forum.com/t/accepts-nested-attributes-for-objects-are-ignored/173784>\
**Category:** Rails\
**Created:** [August 14, 2009, 7:00pm UTC](https://www.ruby-forum.com/t/accepts-nested-attributes-for-objects-are-ignored/173784 "2009-08-14T19:00:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_LSSS\_hr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@Jan\_LSSS\_hr](https://www.ruby-forum.com/u/Jan_LSSS_hr)\
**Post date:** [August 14, 2009, 7:00pm UTC](https://www.ruby-forum.com/t/accepts-nested-attributes-for-objects-are-ignored/173784/1 "2009-08-14T19:00:44Z")

</div>

Hello,

I’ve encountered some annoying problem with  
accepts\_nested\_attributes\_for  
Model is: [http://pastie.org/584213](http://pastie.org/584213)  
Request is: [http://pastie.org/584216](http://pastie.org/584216)  
Controller is: [http://pastie.org/584222](http://pastie.org/584222)  
Record before request = Record after request: [http://pastie.org/584225](http://pastie.org/584225)

Within the request, asemployees\_attributes is a hash containing two  
key/value  
pairs:

key 0 - An employee already associated with this relation  
key 1250268515769 : An employee added using javascript while updating  
the  
event

For some reason 1250268515769 is not associated with the object -  
no “INSERT INTO asemployees\_events (…) VALUES (…)” happens on  
SQL-side.

What might be wrong here?

Thanks in advance  
Keep smiling  
yanosz

---

<div class="post-metadata">

**Author:** ![Jan\_LSSS\_hr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@Jan\_LSSS\_hr](https://www.ruby-forum.com/u/Jan_LSSS_hr)\
**Post date:** [August 14, 2009, 11:39pm UTC](https://www.ruby-forum.com/t/accepts-nested-attributes-for-objects-are-ignored/173784/2 "2009-08-14T23:39:21Z")

</div>

Hello,

On Friday 14 August 2009 18:59:19 Jan Lühr wrote:

> key 1250268515769 : An employee added using javascript while updating the  
> event
> 
> For some reason 1250268515769 is not associated with the object -  
> no “INSERT INTO asemployees\_events (…) VALUES (…)” happens on SQL-side.

I filed it as  
[https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3052-assign\_nested\_attributes\_for\_collection\_association-ought-to-assign-objects-for-collection-if-an-id-is-given-but-the-object-is-currently-not-associated](https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3052-assign_nested_attributes_for_collection_association-ought-to-assign-objects-for-collection-if-an-id-is-given-but-the-object-is-currently-not-associated)  
Feel free to comment.

Keep smiling  
yanosz
