Seriously though, it works fine here: /auth-1.9 821 > script/about About your application's environment Ruby version 1.9.1 (powerpc-darwin9.8.0) RubyGems version 1.3.5 Rack version 1.0 Rails version 2.3.4 Active Record version 2.3.4 Active Resource version 2.3.4 Action Mailer version 2.3.4 Active Support version 2.3.4 Application root /Users/rick/auth-1.9 Environment development Database adapter postgresql Database schema version 20091111184210
Sure the code you've got matches what you've reported? On Nov 16, 12:04 am, Rick <richard.t.ll...@gmail.com> wrote: > validates_presence_of :zipcode > validates_length_of :zipcode :allow_nil => true > > I can hold two competing ideas in my head at one time but I don't > think that's how code works... > > On Nov 15, 6:52 pm, "Todd A. Jacobs" <tjacobs-sndr- > > b4f...@codegnome.org> wrote: > > I have a model that includes the following: > > > validates_presence_of :zipcode > > validates_numericality_of :zipcode, :plus4, :allow_nil=>true > > validates_length_of :zipcode, :is=>5, :allow_nil=>true > > validates_length_of :plus4, :is=>4, :allow_nil=>true > > > The allow_nils are just to prevent the reporting of the same error (say, > > a missing zipcode) multiple ways. The problem is that, when the user > > enters data into the form: > > > <%= f.label :zipcode %>: > > <%= f.text_field :zipcode, :maxlength=>5 %>-<%= f.text_field :plus4, > > :maxlength=>4 %> > > > the validation reports: > > > Zipcode is the wrong length (should be 5 characters) > > > even when the input *is* five digits (e.g. "99999"). What's going on > > here? > > > -- > > "Oh, look: rocks!" > > -- Doctor Who, "Destiny of the Daleks" --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---