# ActiveRecord::Errors is empty when the record is invalid

**URL:** <https://www.ruby-forum.com/t/activerecord-errors-is-empty-when-the-record-is-invalid/186201>\
**Category:** Rails\
**Created:** [April 2, 2010, 1:12am UTC](https://www.ruby-forum.com/t/activerecord-errors-is-empty-when-the-record-is-invalid/186201 "2010-04-02T01:12:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![asetzler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@asetzler](https://www.ruby-forum.com/u/asetzler)\
**Post date:** [April 2, 2010, 1:12am UTC](https://www.ruby-forum.com/t/activerecord-errors-is-empty-when-the-record-is-invalid/186201/1 "2010-04-02T01:12:23Z")

</div>

I’m running into an interesting problem where an ActiveRecord instance  
#valid? returns false, but #errors#full\_messages is empty.

This is in one of my models. The code was run in ruby-debug sitting in  
one of my validation methods.  
(rdb:1) self.publisher\_address.valid?  
false  
(rdb:1) self.publisher\_address.errors.full\_messages  
[]  
(rdb:1) a = Address.new(self.publisher\_address.attributes)  
(rdb:1) a.valid?  
false  
(rdb:1) a.errors.full\_messages  
[“User can’t be blank”, “City can’t be blank”…]

self.publisher\_address is an unsaved Address object, created using  
Address.new. So is a, which I just created. Both are invalid, yet a  
has error messages like it should but self.publisher\_address doesn’t.  
I can’t figure out why.

(rdb:1) self.publisher\_address  
#\<Address id: nil, user\_id: nil,…\>  
(rdb:1) a  
#\<Address id: nil, user\_id: nil,…\>  
(rdb:1) self.publisher\_address.class  
Address(id: integer, user\_id: integer,…)  
(rdb:1) a.class  
Address(id: integer, user\_id: integer,…)

The #publisher\_address method in this model is custom, not an  
association. I get the hash of the attributes and do  
return Address.new(publisher\_address\_attributes)

self.publisher\_address.errors is an AR::Errors object, but the actual  
errors are blank:  
(rdb:1) self.publisher\_address.errors  
#\<ActiveRecord::Errors:0x2cddf50 @base=#\<Address id: nil, user\_id:  
nil,…\>, @errors=#\<OrderedHash {}\>\>

Has anyone seen empty errors like this before?
