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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-28 05:00 UTC
Re: validation of acts_as_list in the model of the base class?
I think what you''re looking for is validates_associated :user_group_nodes. On Dec 28, 2007 3:27 PM, Mukund <maruthim-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > 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. > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---