Thanks for the quick response!

Ok, but then I have to collect and strip off all objects that are saved and 
are *not* associated with their original parent, go through and save 
everything and then using the association_pks to reassociate them, is that 
right?

On Wednesday, March 1, 2017 at 8:34:57 PM UTC+2, Jeremy Evans wrote:
>
> On Wednesday, March 1, 2017 at 10:28:33 AM UTC-8, Aryk Grosz wrote:
>>
>> The nested attributes plugin does not allow to reassociated a nested 
>> foreign_key onto the new parent, either if the parent is saved or new.
>>
>> I would expect this to work. For example, lets say you want to take a 
>> Photo off of one Page, create a new Page, and now add it to that? 
>>
>> The code is throwing the error: Sequel::Error (no matching associated 
>> object with given primary key .
>>
>> I can change the behavior for "unmatched_pk" to ignore, create, or raise, 
>> but not "update", that is switch this saved record to know be associated 
>> with the one I'm attached to.
>>
>> Thoughts?
>>
>
> This behavior is expected. To change which objects are associated to a 
> current object, you can use the association_pks plugin.  The 
> nested_attributes plugin is for creating new associated objects or editing 
> existing associated objects.
>
> Thanks,
> Jeremy 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to