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


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
to get and validate some input, but this information is not to be stored
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

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

… and am wondering if there are any real plans to move the validations
of ActiveRecord and into a separate “ActiveValidation” (or whatever)
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
validation on temporary input data? Mine works, but I’m sure it could
probably be done better. I’ve seen this…

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

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