Validated_associated -- how do I assign invalid collection?


#1

Hi – if I have a class that declares ‘validates_associated’ on a number
of other classes, is it supposed to be relatively easy to replace a
collection of them?
Not to overwrite them in the DB, but simply to assign them to their
retrieval method, so that they can be included as part of the owning
class’ validation.
I mean like:

children_with_potential_errors =
Child.update(params[:child].keys, params[:child].values)
parent.children = children_with_potential_errors
if parent.update_attributes(params[:parent])

else

end

I have a class like Parent above, that has three collections
(one-to-many) like Child above, yet I am having a very diffcult time
trying to get code like that I have outlined working.
Can anyone think of anything I could be missing that might allow me to
replace the collection, or maybe someone is aware of a reason that I
cannot do this?
(If the latter, why would ‘validates_asssociated’ exist?)
Any & all help is very gratefully received – I’ve been stuck on this
for days!
Cheers,
doug.