I''m getting some weird behavior in one of my models. I have a model defined something like this class User < ActiveRecord::Base attr_accessor :password validates_presence_of :password end If I validate the model without specifying a password, I get ["can''t be blank", "can''t be blank"] for :password instead of just one "cant''t be blank". If I comment out the validates_presence_of statement, then no errors. So it doesn''t seem like it''s being defined elsewhere(though a plugin or some such). Any idea what might be going on here? Thanks, Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
When you call the page, do you use a request.post? --~--~---------~--~----~------------~-------~--~----~ 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 10/17/07, Steve <vertebrate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m getting some weird behavior in one of my models. I have a model > defined something like this > > class User < ActiveRecord::Base > attr_accessor :password > > validates_presence_of :password > end > > If I validate the model without specifying a password, I get ["can''t be > blank", "can''t be blank"] for :password instead of just one "cant''t be > blank". If I comment out the validates_presence_of statement, then no > errors. So it doesn''t seem like it''s being defined elsewhere(though a > plugin or some such). Any idea what might be going on here?This can happen if the model file gets loaded twice. Do you have require ''user'' somewhere in your code? --~--~---------~--~----~------------~-------~--~----~ 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 Wed, 17 Oct 2007 16:28:18 -0400, Bob Showalter wrote:> This can happen if the model file gets loaded twice. Do you have > > require ''user'' > > somewhere in your code?Yes, I had a "load" statement in there that was causing this to happen. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---