# ActiveResource does not detect errors for my very simple model

**URL:** <https://www.ruby-forum.com/t/activeresource-does-not-detect-errors-for-my-very-simple-model/187743>\
**Category:** Rails\
**Created:** [April 28, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/activeresource-does-not-detect-errors-for-my-very-simple-model/187743 "2010-04-28T18:18:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [April 28, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/activeresource-does-not-detect-errors-for-my-very-simple-model/187743/1 "2010-04-28T18:18:41Z")

</div>

The documentation says to return a code 422 with a packet in the  
following format:

First cannot be empty

So that is what I am doing. But my model will not raise an exception  
on a create call that returns such a response, and a record created  
that way returns true for its valid? call.

I simply do:

> > Menu.create

Which triggers validation errors in the other application, which  
responds with 422 and the following packet, because a “name” field is  
required:

 Name cannot be empty

Why would ActiveResource interpret such a response as valid? Is there  
something more I need to do in my model for validations to take  
effect? My models themselves are dead simple:

class ApplicationResource \< ActiveResource::Base  
self.site = ‘[http://localhost/frontend/www/api](http://localhost/frontend/www/api)’  
end

class Menu \< ApplicationResource  
end

Thomas

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [April 28, 2010, 6:30pm UTC](https://www.ruby-forum.com/t/activeresource-does-not-detect-errors-for-my-very-simple-model/187743/2 "2010-04-28T18:30:59Z")

</div>

I referred to  
[http://groups.google.com/group/rubyonrails-talk/browse\_thread/thread/67d59a432f1d98e3](http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/67d59a432f1d98e3)  
and tried this with Rails 2.2.2, but got the same result. I am  
guessing the issue I am experiencing is not version-specific.

Thomas
