Well it may not seem like it does not make sense but in the context of this app it does with the what the form is supposed . This is our flow.
1. Site is installed with eqpt. 2. The person using the form puts all eqpt that is on site attached to the form dynamically. 3. I have fields for the eqpt showing that it is installed correctly, settings are correct , .... 4. You can add eqpt but is might not necessarily be installed correctly, have issues, blah.... Step 4 is the reason that the form may be "submitted" but not fully processed until the issues at a site get resolved. On Wed, Jul 29, 2009 at 11:29 AM, Colin Law <[email protected]> wrote: > > 2009/7/29 Chris Habgood <[email protected]>: > > Yes, Site is the main model, equipment is associated. I only want to > > validate the equipment model when conditions exist in the site model. > > Is that 'yes' in response to ' Do you mean you are trying to validate > a model that has already been written to the database'? If so then > that does not make sense. Validation is about checking that data is > correct before allowing it to be written to the db. If it is already > in the db it is too late to validate it. > > Colin > > > > > On Wed, Jul 29, 2009 at 4:48 AM, Colin Law <[email protected]> > wrote: > >> > >> 2009/7/29 Chris Habgood <[email protected]>: > >> > Well sort of. I really need to validate another model based on the > >> > original > >> > form(model) conditions. > >> > >> Do you mean you are trying to validate a model that has already been > >> written to the database, when a form for a different model is > >> submitted? If not I think a little more detail in exactly what you > >> are trying to do may help. > >> > >> Colin > >> > >> > >> > > >> > On Tue, Jul 28, 2009 at 10:25 PM, Nicholas Henry > >> > <[email protected]> > >> > wrote: > >> >> > >> >> This maybe of some help: > >> >> > >> >> http://railscasts.com/episodes/41-conditional-validations > >> >> > >> >> Cheers, > >> >> Nicholas > >> >> > >> >> On Jul 28, 10:15 pm, Me <[email protected]> wrote: > >> >> > If I have a site model that has_many :equipments, how would I > >> >> > validate > >> >> > the equipment only when ceratin conditions exist in the site model? > >> >> > > >> >> > I add the equipment dynamically in the Site form and also the form > >> >> > will not necessarily be "fully submitted" until some conditions > exist > >> >> > in the main site form. > >> >> > >> > > >> > > >> > > > >> > > >> > >> > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

