rails/activerecord/test/cases/attribute_methods
Jean Boussier a0993f81d0 Define missing attribute methods from method_missing
Ref: https://github.com/mastodon/mastodon/issues/27622

If applications don't eager load and use the old Rails 6.1 Marshal
format, they can load Active Record instances from caches without
calling `init_internals` hence attribute methods and aliases are
nnot defined yet, leading to `NoMethodError`

Initially I was hopping to fully get rid of the `define_attribute_methods`
call in `init_internals` in favor of this new method missing, as it would
remove work from the happy path, unfortunately that isn't possible
because if a generated method overrides a default method inherited from
object, `method_missing` won't be called. e.g. `Kernel#format`

We may want to get rid of this extra code once we remove support
for the 6.1 marshal format.
2024-01-05 16:56:19 +01:00
..
read_test.rb Define missing attribute methods from method_missing 2024-01-05 16:56:19 +01:00