Skip to content
  • Jean Boussier's avatar
    869080ed
    class_attribute: delegate to an internal namespaced method · 869080ed
    Jean Boussier authored
    Fix: https://github.com/rails/rails/issues/53606
    
    
    
    `class_attribute` never composed well with `prepend` or `alias_method_chain`.
    Up to 7.2, whenever the value was re-assigned, the reder method was redefined.
    
    Now, since 8.0, we no longer redefine the reader, or at least in less cases,
    but then the writer is sometimes redefined too, which restrict even more
    how much decoration can be done.
    
    A solution to this is to define class attributes under a namespaces
    and then define a two simple delegator methods to allow decoration.
    
    Of course it's one extra method call, but that's still miles better
    than what it used to be, and probably acceptable.
    
    Co-Authored-By: default avatarzvkemp <zvkemp@gmail.com>
    869080ed
    class_attribute: delegate to an internal namespaced method
    Jean Boussier authored
    Fix: https://github.com/rails/rails/issues/53606
    
    
    
    `class_attribute` never composed well with `prepend` or `alias_method_chain`.
    Up to 7.2, whenever the value was re-assigned, the reder method was redefined.
    
    Now, since 8.0, we no longer redefine the reader, or at least in less cases,
    but then the writer is sometimes redefined too, which restrict even more
    how much decoration can be done.
    
    A solution to this is to define class attributes under a namespaces
    and then define a two simple delegator methods to allow decoration.
    
    Of course it's one extra method call, but that's still miles better
    than what it used to be, and probably acceptable.
    
    Co-Authored-By: default avatarzvkemp <zvkemp@gmail.com>
Loading