Validation of acts_as_list in the model of the base class?

Lets say I have 3 models, user, user_group and user_group_nodes. A
normal user has one user_group_id as a foreign key and a special user
has multiple user_groups which are defined in the user_group_nodes.
The user_group_nodes is a “acts_as_list” for user and contains a list
of group_ids.

When I build a form to get user input and I want to save it, is there
a way to validate the presence of the child nodes in the model of
“user” so that I can permit the user to be saved only if the child
nodes are validated? I also wanted to use the errors_on etc. which
are accessible only at the model level.

I think what you’re looking for is validates_associated
:user_group_nodes.

On Dec 28, 2007 3:27 PM, Mukund [email protected] wrote:

nodes are validated? I also wanted to use the errors_on etc. which
are accessible only at the model level.


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.