Is there one command to save an ActiveRecord and all dependents?

Hi,

When testing, I sometimes modify a parent object, save it, but then
get tripped up bc the dependents do not reflect the change (maybe that
should be obvious.)

I’m wondering, is there a command that saves an ActiveRecord instance
and all its dependents?

Thanks,

Lille

you can call save on the childs but there is also this method

accepts_nested_attributes_for :child

thats how is was called in rails 2 try finding out if its called the
same in rails 3.

instead of child put the name of the child model

On 11 October 2010 15:32, Lille [email protected] wrote:

Hi,

When testing, I sometimes modify a parent object, save it, but then
get tripped up bc the dependents do not reflect the change (maybe that
should be obvious.)

I’m wondering, is there a command that saves an ActiveRecord instance
and all its dependents?

Why should you need to save the dependents if it is only the parent
that you have modified?

Colin

@colin

I think he wants to change a child with fields_for and but my not be
aware
that the method exist, its the only way i can make sense out of his
question

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs