Hi, I''ve created a simple wizard that collects data in 3 steps and then posts it to a Create action. Validation is only performed when the data is posted. However, I would like the individual steps to be validated as well. Any ideas on this one? Example: Step 1 Name Email Email (confirm) Is there a generic way to let ActiveRecord validate the individual fields of a Model Object instead of the entire thing? CmdJohnson --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 11 Jan 2009, at 14:04, Commander Johnson wrote:> Hi, > > I''ve created a simple wizard that collects data in 3 steps and then > posts it to a Create action. > > Validation is only performed when the data is posted. However, I > would like the individual steps to be validated as well. Any ideas > on this one? > > Example: > Step 1 > Name > Email > Email (confirm) > > Is there a generic way to let ActiveRecord validate the individual > fields of a Model Object instead of the entire thing? >The if/unless options on validates_* may be of interest. Fred> CmdJohnson > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Could you please post some code to explainify? On Sun, Jan 11, 2009 at 3:20 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 11 Jan 2009, at 14:04, Commander Johnson wrote: > > > Hi, > > > > I''ve created a simple wizard that collects data in 3 steps and then > > posts it to a Create action. > > > > Validation is only performed when the data is posted. However, I > > would like the individual steps to be validated as well. Any ideas > > on this one? > > > > Example: > > Step 1 > > Name > > Email > > Email (confirm) > > > > Is there a generic way to let ActiveRecord validate the individual > > fields of a Model Object instead of the entire thing? > > > The if/unless options on validates_* may be of interest. > > Fred > > > CmdJohnson > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 16 Jan 2009, at 21:27, Commander Johnson wrote:> Could you please post some code to explainify? >validates_foo :if => :bar will run that validation only if the bar method returns true. so you can conditionalize your validations on anything you want. Fred> On Sun, Jan 11, 2009 at 3:20 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > > > On 11 Jan 2009, at 14:04, Commander Johnson wrote: > > > Hi, > > > > I''ve created a simple wizard that collects data in 3 steps and then > > posts it to a Create action. > > > > Validation is only performed when the data is posted. However, I > > would like the individual steps to be validated as well. Any ideas > > on this one? > > > > Example: > > Step 1 > > Name > > Email > > Email (confirm) > > > > Is there a generic way to let ActiveRecord validate the individual > > fields of a Model Object instead of the entire thing? > > > The if/unless options on validates_* may be of interest. > > Fred > > > CmdJohnson > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---