• Igor Drozdov's avatar
    Handle Rails 6.1 ActiveModel::Errors changes · d8c66f44
    Igor Drozdov authored
    Modal errors as objects are introduced:
    https://github.com/rails/rails/pull/32313
    
    model.errors.first returns ActiveModel::Error object
    that's why model.errors.first[1] doesn't work in Rails 6.1
    
    We need a way that works both for 6.1 and 6.0 in order to
    introduce changes gradually:
    
    model.errors.values.first works for both versions.
    
    Even though treating errors as a hash is deprecated it works
    so we can introduce the changes in 6.0 and then fix the
    deprecations when we're on 6.1
    
    (cherry picked from commit b5ecc309314429040921233d4a6216655fede089)
    d8c66f44
addressable_url_validator_spec.rb 9.09 KB