Commit fe29d65
committed
Fix model_name availability when using ActiveModel::Serialization
In v4.0.0, switching from `extend ActiveModel::Naming` to only `extend
ActiveModel::Translation` can cause "undefined method 'model_name'" errors
when ActiveHash models include ActiveModel::Serialization, particularly
with Rails 8.0+.
While ActiveModel::Translation includes ActiveModel::Naming internally,
the inclusion doesn't always properly expose the model_name class method
when extended. This breaks compatibility for models that depend on
model_name being available at the class level.
This commit explicitly extends both ActiveModel::Naming and
ActiveModel::Translation to ensure model_name is always available while
maintaining i18n support. This approach ensures compatibility across all
Rails versions.
Signed-off-by: moznion <[email protected]>1 parent c2582a7 commit fe29d65
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments