Hi --

On Tue, 5 Aug 2008, Phlip wrote:

> David A. Black wrote:
>
>> Couldn't you just write a #valid? method for the class, or something
>> like that?
>
> Obviously yes but why should we have to? validates_presence_of :foo only 
> needs to peek at self.foo, so why should we have to rewrite it?

I think it's reasonable for ActiveRecord::Validations to be fairly
hard-wired to ActiveRecord, so it might just be less trouble in the
end to roll your own for non-AR classes. Or maybe write
ActiveSupport::Validations, which could be more general (and not get
into the create/update/save distinctions and all that).


David

-- 
Rails training from David A. Black and Ruby Power and Light:
  *  Advancing With Rails    August 18-21    Edison, NJ
  * Co-taught by D.A. Black and Erik Kastner
See http://www.rubypal.com for details and updates!