Dear Railers, I''m having trouble with the following code: validates_format_of :class, :with => /^PL[DTV]\d{1}[a-z]{1}/, :message => ''blah blah:'' The class should start with PL and be followed by D, T or V, followed by 1 digit and one letter. Now I tried things like PLV2a, PLT1c and so on; none will validate... I tried the REGEX it in BBedit with GREP searching and the pattern ^PL[DTV]\d{1}[a-z]{1} finds all of them without problems... Any clue... Kind regards, Robert. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
le colibri wrote:> validates_format_of :class, :with => /^PL[DTV]\d{1}[a-z]{1}/, :message > => ''blah blah:'' > > The class should start with PL and be followed by D, T or V, followed > by 1 digit and one letter. > > Now I tried things like PLV2a, PLT1c and so on; none will validate... > > I tried the REGEX it in BBedit with GREP searching and the pattern > ^PL[DTV]\d{1}[a-z]{1} finds all of them without problems...Rename your attribute to avoid clashing with the built-in class method. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mark Reginald James wrote:> le colibri wrote: > > > validates_format_of :class, :with => /^PL[DTV]\d{1}[a-z]{1}/, :message > > => ''blah blah:'' > > > > The class should start with PL and be followed by D, T or V, followed > > by 1 digit and one letter. > > > > Now I tried things like PLV2a, PLT1c and so on; none will validate... > > > > I tried the REGEX it in BBedit with GREP searching and the pattern > > ^PL[DTV]\d{1}[a-z]{1} finds all of them without problems... > > Rename your attribute to avoid clashing with the built-in class method.Thanks Mark, it works like a charm now. Robert. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---