How to disable validation during a migration

I have a migration I am doing which involves a change in column name
that my model uses for validation.

Part of the migration is changing data in that column, which would
fail the validation, but will pass the new validation.

Is there anyway I can “turn off validation” inside the migration for
the duration of the migration?

I have worked around it… but would be good to know for future ref.

Thanks

Mikel

Mikel wrote:

I have a migration I am doing which involves a change in column name
that my model uses for validation.

Part of the migration is changing data in that column, which would
fail the validation, but will pass the new validation.

Is there anyway I can “turn off validation” inside the migration for
the duration of the migration?

I have worked around it… but would be good to know for future ref.

I’m not sure I understand the question, but you can always say…

whatever.save_with_validation(false)

…to skip validation.

–Al Evans

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs