On Jueves, 25 de Junio de 2009 12:33:00 C F Tong escribió:
> In a "Parent" has many "child" situation, I found that when the child
> is removed, the child.parent_id is set null and the child record still
> exists.
>
> I am just studying the code and want to know where does activescaffold
> perform this action.

AS builds a child record for each line in the form, and then assign them to 
association:
record.children = [child1, child2, ...]
If record had child1 and child2 and you set after child2 and child3 you are 
removing association between child1 and record. Rails will remove child1 if 
you set dependent destroy or delete_all in your has_many association. It's a 
rails issue more than an AS issue.

>
> On 6月25日, 上午2時17分, [email protected] wrote:
> > If the child record is deleted by the user then the association is gone
> > because the child record no longer exists.
> >
> > Can you explain what you are trying to do a little more?
> > Sent from my Verizon Wireless BlackBerry
> >
> > -----Original Message-----
> > From: C F Tong <[email protected]>
> >
> > Date: Wed, 24 Jun 2009 08:23:47
> > To: ActiveScaffold : Ruby on Rails
> > plugin<[email protected]> Subject: Re: where does
> > update_record_from_params set null on id
> >
> > Thank you. Then where does the child record lose it association to
> > parent when the child is deleted by user?
> >
> > On 6月24日, 下午5時08分, "Sergio Cambra .:: entreCables S.L. ::."
> >
> > <[email protected]> wrote:
> > > On Martes, 23 de Junio de 2009 18:05:20 C F Tong escribió:
> > > > where does update_record_from_params set null on id when the child
> > > > record is deleted from parent record?
> > > >
> > > > i mean which line in update_record_from_params
> > >
> > > update_record_from_params don't set null on id when a child record is
> > > deleted. It sets association like parent.association =
> > > associated_value, where associated_value is an array (for plural
> > > associations like has_many) with the associated records (and without
> > > deleted child records).
> > >
> > > --
> > > Sergio Cambra .:: entreCables S.L. ::.
> > > Mariana Pineda 23, 50.018 Zaragoza
> > > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> 
-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to