# ActiveRecord Errors are all nil

**URL:** <https://www.ruby-forum.com/t/activerecord-errors-are-all-nil/145492>\
**Category:** Rails\
**Created:** [August 10, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/activerecord-errors-are-all-nil/145492 "2008-08-10T19:56:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![omarqazi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f4b2a3/32.png) [@omarqazi](https://www.ruby-forum.com/u/omarqazi)\
**Post date:** [August 10, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/activerecord-errors-are-all-nil/145492/1 "2008-08-10T19:56:26Z")

</div>

I have an Active Record model in Rails 2.1 that is doing some  
validation, specifically, these methods:

validates\_presence\_of :name, :email, :phone  
validates\_uniqueness\_of :name  
validates\_format\_of :email, :with =\> /.+@.+…{2,4}/  
validates\_confirmation\_of :password  
validate :has\_password  
attr\_accessor :password

When I try to save a user object that does not meet all of these  
requirements, the object does not save, but there are no errors  
either.

Loading development environment (Rails 2.1.0)

> > user = User.new  
> > =\> #\<User id: nil, name: nil, email: nil, hashed\_password: nil, salt:  
> > nil, phone: nil, created\_at: nil, updated\_at: nil\>
> 
> > user.save  
> > =\> false
> 
> > user.errors[:name]  
> > =\> nil
> 
> >

Any idea what’s going on?

---

<div class="post-metadata">

**Author:** ![omarqazi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f4b2a3/32.png) [@omarqazi](https://www.ruby-forum.com/u/omarqazi)\
**Post date:** [August 10, 2008, 8:59pm UTC](https://www.ruby-forum.com/t/activerecord-errors-are-all-nil/145492/2 "2008-08-10T20:59:04Z")

</div>

On Aug 10, 10:55 am, Omar Q. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When I try to save a user object that does not meet all of these  
> requirements, the object does not save, but there are no errors  
> either.

Using your code (minus the parts regarding the password validation),  
in a test rails app works fine here.
