# Validation without ActiveRecord (was Re: contact form/no db

**URL:** <https://www.ruby-forum.com/t/validation-without-activerecord-was-re-contact-form-no-db/47807>\
**Category:** Rails\
**Created:** [November 14, 2005, 1:38am UTC](https://www.ruby-forum.com/t/validation-without-activerecord-was-re-contact-form-no-db/47807 "2005-11-14T01:38:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://www.ruby-forum.com/u/dave)\
**Post date:** [November 14, 2005, 1:38am UTC](https://www.ruby-forum.com/t/validation-without-activerecord-was-re-contact-form-no-db/47807/1 "2005-11-14T01:38:41Z")

</div>

On Sunday 13 Nov 2005 23:47, Nathaniel S. H. Brown wrote:

> When you generate your model, simply remove the “\< ActiveRecord::Base”  
> within the class definition,  
> […]  
> You will not get all the nice features of ActiveRecord, such as find,  
> before\_filter, etc. But from what it sounds like you are after, you don’t  
> really need most of them anyways.

I have a question that is related to this. I too have a form that is  
required  
to get and validate some input, but this information is not to be stored  
in  
the database - it’s just needed to complete a payment transaction  
(handled by  
an external server).

It’s all good an working fine - my model does not inherit from  
ActiveRecord.

However, I have to validate the fields as they are entered, and have  
resorted  
to just coding the validations myself. I’ve seen this thread…

[http://wrath.rubyonrails.org/pipermail/rails/2004-December/001069.html](http://wrath.rubyonrails.org/pipermail/rails/2004-December/001069.html)

… and am wondering if there are any real plans to move the validations  
out  
of ActiveRecord and into a separate “ActiveValidation” (or whatever)  
system,  
that ActiveRecord could still make use of, but that could also be used  
separately from just validating stuff that is going into a database?

It would seem to make sense, because validation is needed in a lot of  
situations that aren’t necessarily tied in with a database. Does anyone  
(DHH?) know what the longer-term plans are?

In the meantime, has anyone got any really neat examples of doing their  
own  
validation on temporary input data? Mine works, but I’m sure it could  
probably be done better. I’ve seen this…

[http://wiki.rubyonrails.com/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord](http://wiki.rubyonrails.com/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord)

… but I’m not sure it suits my needs. I never call save on this  
model,  
because it really is just used to get some temporary data and pass it  
on.  
(Perhaps I’ve misunderstood the workings of that code, and it actually  
might  
work without ever calling save - I’m not sure.)

Surely someone has come up with an elegant, non-kludgy way of doing  
this?

Thanks,

~Dave
