On Sunday, February 8, 2015 at 8:35:44 PM UTC-8, Brian Wigginton wrote:
>
> Hello fellow Sequelers,
>
> I have a model property that points to a column with a not null constraint. 
> That property is autovalidated before it is sent to the database as 
> expected. However, I'd like to skip the null check for a single column as 
> I'm generating the content with a trigger if it is NULL. I've tried adding: 
> skip_auto_validations 
> :not_null This works but is disabling null checks on *all* my model 
> properties. I'd like to just remove the null check for a *single property*. 
> What's the best way to do this?
>

ModelClass.auto_validate_not_null_columns.delete(:column_name)
ModelClass.auto_validate_explicit_not_null_columns.delete(:column_name)

:column_name should only appear in one of those arrays, depending on 
whether the column has a default value.  Since you are filling in the 
default value with a trigger, I'm guessing the former, but it won't hurt to 
remove it from both.

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