Forum: Ruby on Rails Validation without ActiveRecord (was Re: contact form/no db

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cf7e5e4b5ca573eec214191fac420a2f?d=identicon&s=25 dave (Guest)
on 2005-11-14 01:38
(Received via mailing list)
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-...

... 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/HowToUseVa...

... 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
This topic is locked and can not be replied to.