Forum: Ruby on Rails Would validation w/o ActiveRecord have clean sol'n?

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.
Daa9264aae3b23bdc8135d6b6899ff4b?d=identicon&s=25 Benton Lam (calyth)
on 2006-04-13 10:12
Well I was using Rails for a class project, and frankly I love it.
However I ran into situation that I want to use have a model object that
doesn't get stored into the database, and still have the same
validation.
The Rails wiki outlines a solution, but it's still kind of a hack (e.g.
I can't create a new instance of the non-ActiveRecord model by passing a
hash into initialize)
I'm wondering if having some kind of base class that allows for
validation functionality without hooking up to a DB is under
consideration, or better yet, if there's a clean solution for this type
of problem already.
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-04-13 17:25
(Received via mailing list)
On 4/13/06, Benton Lam <calyth@gmail.com> wrote:
> of problem already.
>

The "Rails Recipes" book has a decent solution for this.  Basically,
you just need to make sure a few (empty) methods are available in the
class you want to validate.
This topic is locked and can not be replied to.