I want to validate a field in my form that''s not an attribute in the model. How do I do this? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
define it as a getter and setter. On Fri, Feb 27, 2009 at 10:49 AM, Mike C <snibble-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I want to validate a field in my form that''s not an attribute in the > model. How do I do this? > > >-- TWRUG Blog: http://blog.rubyonrails.org.tw CFC on Rails: http://zusocfc.blogspot.com Only two surfaces of a box: http://blog.pixnet.net/zusocfc --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ok, I did it. But in the model I have validates_presence_of, and even though the field is filled, I keep getting the blank error. On Feb 26, 9:52 pm, CFC <zuso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> define it as a getter and setter. > > On Fri, Feb 27, 2009 at 10:49 AM, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I want to validate a field in my form that''s not an attribute in the > > model. How do I do this? > > -- > TWRUG Blog:http://blog.rubyonrails.org.tw > > CFC on Rails:http://zusocfc.blogspot.com > > Only two surfaces of a box:http://blog.pixnet.net/zusocfc--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nevermind, getter was returning a user object instead of a string. fixed. :) On Feb 26, 10:10 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok, I did it. But in the model I have validates_presence_of, and even > though the field is filled, I keep getting the blank error. > > On Feb 26, 9:52 pm, CFC <zuso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > define it as a getter and setter. > > > On Fri, Feb 27, 2009 at 10:49 AM, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I want to validate a field in my form that''s not an attribute in the > > > model. How do I do this? > > > -- > > TWRUG Blog:http://blog.rubyonrails.org.tw > > > CFC on Rails:http://zusocfc.blogspot.com > > > Only two surfaces of a box:http://blog.pixnet.net/zusocfc--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Mike. Can you share the code snippet for the getter and setter methods you used, thanks. On Fri, Feb 27, 2009 at 1:48 PM, Mike C <snibble-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Nevermind, getter was returning a user object instead of a string. > fixed. :) > > On Feb 26, 10:10 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Ok, I did it. But in the model I have validates_presence_of, and even > > though the field is filled, I keep getting the blank error. > > > > On Feb 26, 9:52 pm, CFC <zuso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > define it as a getter and setter. > > > > > On Fri, Feb 27, 2009 at 10:49 AM, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I want to validate a field in my form that''s not an attribute in the > > > > model. How do I do this? > > > > > -- > > > TWRUG Blog:http://blog.rubyonrails.org.tw > > > > > CFC on Rails:http://zusocfc.blogspot.com > > > > > Only two surfaces of a box:http://blog.pixnet.net/zusocfc > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---