Skip to content
代码片段 群组 项目
  • Igor Drozdov's avatar
    d8c66f44
    Handle Rails 6.1 ActiveModel::Errors changes · d8c66f44
    Igor Drozdov 创作于
    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
    历史
    Handle Rails 6.1 ActiveModel::Errors changes
    Igor Drozdov 创作于
    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)
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。