Skip to content
  • Kouhei Yanagita's avatar
    40079651
    Use `each_pair` in `ActiveModel::AttributeAssignment#_assign_attributes` · 40079651
    Kouhei Yanagita authored
    `ActiveModel::AttributeAssignment#assign_attributes` checks if the argument
    responds to `each_pair`, and raises an exception if it does not.
    
    However, in `_assign_attributes`, the argument is enumerated using `each`.
    As a result, if the argument has `each_pair` but not `each`,
    this error check results in a false negative.
    (An example of such an object is `OpenStruct`.)
    40079651
    Use `each_pair` in `ActiveModel::AttributeAssignment#_assign_attributes`
    Kouhei Yanagita authored
    `ActiveModel::AttributeAssignment#assign_attributes` checks if the argument
    responds to `each_pair`, and raises an exception if it does not.
    
    However, in `_assign_attributes`, the argument is enumerated using `each`.
    As a result, if the argument has `each_pair` but not `each`,
    this error check results in a false negative.
    (An example of such an object is `OpenStruct`.)
Loading