Skip to content
  • Eugene Kenny's avatar
    d2e2ca0d
    Always load validator class to verify it exists · d2e2ca0d
    Eugene Kenny authored
    When updating our app for 9def0538, I
    found several incorrectly configured validations that looked like this:
    
        validates :name, uniqueness: true, case_sensitive: false
    
    The intent is clearly for `case_sensitive: false` to be passed as an
    option to the uniqueness validator, but instead it's being passed as
    its own separate validation. Because the value `false` disables the
    validation, the validator class isn't loaded and the failure is silent.
    
    The validator should always be loaded, even if it's disabled, to ensure
    it exists and avoid configuration errors like the one described above.
    d2e2ca0d
    Always load validator class to verify it exists
    Eugene Kenny authored
    When updating our app for 9def0538, I
    found several incorrectly configured validations that looked like this:
    
        validates :name, uniqueness: true, case_sensitive: false
    
    The intent is clearly for `case_sensitive: false` to be passed as an
    option to the uniqueness validator, but instead it's being passed as
    its own separate validation. Because the value `false` disables the
    validation, the validator class isn't loaded and the failure is silent.
    
    The validator should always be loaded, even if it's disabled, to ensure
    it exists and avoid configuration errors like the one described above.
Loading