Rohit said:
> it seems to me that Sequel is behaving as advertised.

Oh, I agree. I never said I thought I'd found a bug, after all. My lead comment 
was

>> Sequel and I aren't agreeing as to what constitutes validity.


Jeremy said: 

> Sequel does not parse database constraints.  The reason you get that
> error (a typecasting error, not a validation error), is that the NULL/
> NOT NULL information is determined when parsing the column schema for
> the table (for use in typecasting).

Right. I know it doesn't parse all of them because Sequel was unable to catch 
(or typecast) a too-short UUID I tried to sneak into the database. 

> Validations are always specified by the user, and exist solely to
> provide nice error messages to the user (often on websites).

I assume you mean specified by the *programmer*, to provide nice messages to 
the user?

> If you are writing code that interfaces with the
> user, you'll want to add a validate method to your models and handle
> validation there.


Sure, and I first started to do exactly that, by creating my own .valid? 
method. Then I discovered there already was one. 

I'm just surprised that there doesn't seem to be a way to do something like 

        plugin :validation_helpers

        def validate
                super
                validates_against_types
        end

especially since Sequel, generally, has been very (I would even say 
astonishingly) clever about not making me tell it things that it can learn 
directly from the database. 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to