Skip to content
  • Greg Navis's avatar
    461d88a5
    Fix composed_of freezing and duplication · 461d88a5
    Greg Navis authored
    composed_of values should be automatically frozen by Active Record.
    This worked correctly when assigning a new value object via the writer,
    but objects instantiated based on database columns were NOT frozen. The
    fix consists of calling #dup and then #freeze on the cached value
    object when it's added to the aggregation cache in #reader_method.
    
    Additionally, values assigned via the accessor are duplicated and then
    frozen to avoid caller confusion.
    461d88a5
    Fix composed_of freezing and duplication
    Greg Navis authored
    composed_of values should be automatically frozen by Active Record.
    This worked correctly when assigning a new value object via the writer,
    but objects instantiated based on database columns were NOT frozen. The
    fix consists of calling #dup and then #freeze on the cached value
    object when it's added to the aggregation cache in #reader_method.
    
    Additionally, values assigned via the accessor are duplicated and then
    frozen to avoid caller confusion.
Loading