Add validation to prevent out of range for ActiveRecord::Type::Integer with limit 4

I am running into out of range for ActiveRecord::Type::Integer with limit 4 error when typing a number over 10 digits. I want to add a validation to prevent this error from popping up.

validates :duration, numericality: { only_integer: true, greater_than: 0, less_than_or_equal_to: 9999999999 }


But I am still getting the same error. I read that changing the column to limit 8 would solve this but is there a workaround where I do not need to change the DB

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

Sponsor our Newsletter | Privacy Policy | Terms of Service