On Thursday, May 22, 2014 7:31:40 AM UTC-7, Patrick Kuykendall wrote:
>
> I'm not sure if this is a bug, or not, or if there may be some 
> configuration I can do to avoid this. I'm running into an issue with the 
> auto_validations for :type failing when the name of a column conflicts with 
> other attributes of the model.
>
> For instance, if I have a table with a column named 'class' and data type 
> if 'int,' when the auto_validations run the model will be marked invalid 
> with the following error hash: 
>
> {
>     :class => [
>         [0] "is not a valid integer"
>     ]
> }
>
> I think this may be due to the validation_helper performing a 'send' and 
> passing 'class' which results in the object returning its class and not the 
> value stored in the 'class' field.
>
> Does anyone have any tips?
>

This is because validations call methods, and Sequel does not override 
existing methods when creating methods for the columns.

You should turn off the auto type validations for the class:

 ModelClass.skip_auto_validations(:types)

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to