# Validating non ActiveRecord objects

**URL:** <https://www.ruby-forum.com/t/validating-non-activerecord-objects/115236>\
**Category:** Rails\
**Created:** [September 22, 2007, 2:55am UTC](https://www.ruby-forum.com/t/validating-non-activerecord-objects/115236 "2007-09-22T02:55:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Pierson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@Sam\_Pierson](https://www.ruby-forum.com/u/Sam_Pierson)\
**Post date:** [September 22, 2007, 2:55am UTC](https://www.ruby-forum.com/t/validating-non-activerecord-objects/115236/1 "2007-09-22T02:55:11Z")

</div>

I’ve seen a few semi-solutions to this issue but nothing recent and  
coherent.  
What is the best way to use the AR validation system on non-AR objects?  
Seems like this come up enough it should be a HowTo on the Rails site.

Thanks,

-Sam.

---

<div class="post-metadata">

**Author:** ![Sam\_Pierson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@Sam\_Pierson](https://www.ruby-forum.com/u/Sam_Pierson)\
**Post date:** [September 23, 2007, 9:46am UTC](https://www.ruby-forum.com/t/validating-non-activerecord-objects/115236/2 "2007-09-23T09:46:35Z")

</div>

Sam Pierson wrote:

> I’ve seen a few semi-solutions to this issue but nothing recent and  
> coherent.  
> What is the best way to use the AR validation system on non-AR objects?  
> Seems like this come up enough it should be a HowTo on the Rails site.
> 
> Thanks,
> 
> -Sam.

Sam,

Why not mixin ActiveRecord::Validations, override #validate, and call  
#valid? when needed?

David B. Williams  
[http://www.cybersprocket.com](http://www.cybersprocket.com)
