These class attributes behave something like the class inheritable accessors. But instead of copying the hash over at the time the subclass is first defined, the accessors simply delegate to their superclass unless they have been given a specific value. This stops the strange situation where values set after class definition don’t get applied to subclasses.
From active_support/core_ext/class/attribute_accessors.rb
Extends the class object with class and instance accessors for class attributes, just like the native attr* accessors for instance attributes.
From active_support/core_ext/class/inheritable_attributes.rb
Allows attributes to be shared within an inheritance hierarchy, but where each descendant gets a copy of their parents’ attributes, instead of just a pointer to the same. This means that the child can add elements to, for example, an array without those additions being shared with either their parent, siblings, or children, which is unlike the regular class-level attributes that are shared across the entire hierarchy.
| Constants | |
|---|---|
| EMPTY_ |
Prevent this constant from being created multiple times |
| Aliases | |
|---|---|
| inherited_ |
|
| Private Methods | |
|---|---|
| inherited | Alias for #inherited_with_inheritable_attributes |
| inherited_ |
|
<code/>and<pre/>for code samples.